Support » Plugins and Hacks » [Resolved] Permalinks causing 404 errors on custom post type

[Resolved] Permalinks causing 404 errors on custom post type

  • Hi,

    I have created the following custom post type:


    Permalinks are set to:


    A sample URL for one of the created events is:


    Yet this gives a 404 when we try it. What do we have to do to get the permalinks working? We’ve already tried re-saving the permalinks a few times.



Viewing 15 replies - 1 through 15 (of 24 total)
  • Further to this, the links don’t even work with standard permalinks.

    Is there something I’m missing? I’ve set any taxonomies but I assumed I didn’t need to?


    Plugin Author Michael Beckwith


    So the links to your CPT posts aren’t working even without permalinks?

    Nope, taxonomies aren’t a requirement for it to work.

    Could you pastebin the settings you used for your CPT? I’ll see if it gives me the same issues at all. You’ll be able to get them in a pasteable format via the “Get Code” link when you go to edit the CPT. Ignore the “broken” quotes aspect, that’s fixed in the next, pending, release, and this isn’t what does the actual registering.

    Hi Michael,

    Thats right. I’ve spent the last two hours struggling to get any links to work at all. Normal posts and pages work fine with any permalink structure in place though.

    This is a dev site we’re working on and its hosted on a Windows server. This wouldn’t make a different for the rewrite rules would it?

    Custom Post Type settings:
    (incidentally they give an error if I try and paste into functions.php manually)


    <rule name="wordpress" patternSyntax="Wildcard">
    	<match url="*"/>
    			<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
    			<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
    	<action type="Rewrite" url="index.php"/>

    Plugin Author Michael Beckwith


    Actually, I think it would have an influence on rewrites. Linux hosting and Windows hosting aren’t the same with this topic. That said, I’m also out of the running for good help, as I have never debugged IIS issues with rewrites :(. I’m wondering if that’s the primary area of issue.

    Yeah, you’d need to review the pastebin code before pasting into functions.php and hitting save, make sure it’s done right. Like I said in my first reply, it’s pending fixed in the next release. Hopefully soon.

    Hmm that makes things awkward!

    Should the permalinks work “straight out of the box” generally then? Do you have an example of a .htaccess file for my sceneario above I could use to compare? Might help with any debugging.

    Ok, this is getting strange now. I’ve just tried the following code directly in my functions.php, and it works perfectly now!


    The codes is what I took using “Get Code”, but I had to amend a few extra unneeded apostrophes. I resaved the permalinks setting and it worked. The web.config file remains unchanged though.

    Why would putting the code directly in functions.php cause it to work? Surely its exactly the same?

    Any ideas?


    Just for extra details, I commented out the code, resaved the permalinks settings and straight away the link gives a 404.

    Plugin Author Michael Beckwith


    One would think so. Here’s an example from a linux hosted version, with one of the default options available.

    # BEGIN WordPress
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress

    I was having the same problem and it was driving me crazy for 2 weeks. I was able to fix it by going to the Advanced Options on the post type I was trying to view, and change “Has Archive” to “True” and boom, they worked!

    Plugin Author Michael Beckwith


    thanks for the feedback ibecker. Hopefully that helps pixelkicks. Now to have me remember that that needs to true for archives to work. 😀

    i am having the same problem. sorry no such page error when previewing changes to published post.
    i have been reading forums for a week and have tried all the recommended fixes except adding flush rewrite rules. not sure where to place this code.
    any help with this?

    Plugin Author Michael Beckwith


    ucarman2002, just visiting the permalinks settings page should flush you rewrite rules.

    That sounds positive ibecker, and I’ll give it a try in future.

    As it was I had to stop using the plug-in, instead using some code I found on another website to create the custom post types. Got it working perfectly in the end.

    Maybe it might have just been the “Has Archive” settting all along.

    Plugin Author Michael Beckwith


    No worries here. I’d rather you get what you need done than if it involves our plugin 🙂

    visiting the permalinks page does not solve problem.
    preview changes after post is published still produces 404 error. page not found.
    have tried in different themes.
    have tried disabling all plugins,except custom post type UI.
    I believe the problem was caused by having posts with the same name as the custom post type. I deleted all of those and tried all of the above again. no luck.
    any ideas?

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘[Resolved] Permalinks causing 404 errors on custom post type’ is closed to new replies.