WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type Permalinks
All custom post type pages and categories result in 404s (16 posts)

  1. Ryan
    Member
    Posted 2 years ago #

    This plugin is exactly what I was searching for, but unfortunately I'm not having any luck with it.

    I have a custom post type called "food", and a custom taxonomy called "fruit". I want URLs like:

    POSTS: /food/apples/a-post-title
    ARCHIVES: /food/fruit/apples

    When I use the Custom Post Type Permalink structure: /%fruit%/%postname%/ and I check the "Use custom permalink of custom taxonomy archive." box, all my posts for the custom post type (and all my custom taxonomy archive pages) result in a 404.

    Any assistance is much appreciated.

    -R

    http://wordpress.org/extend/plugins/custom-post-type-permalinks/

  2. archersify
    Member
    Posted 2 years ago #

    Im getting the same problem. :( the permalink structure is working correctly but im getting 404 page not found errors. :( Anyone?

  3. Sheharyar
    Member
    Posted 2 years ago #

    Okay, found a solution.

    1. Make your changes in Settings > Permalinks
    2. Save It
    3. Save It again, without changing anything.

    This got it working for me. You have to save it twice for some reason. I think it has something to do with Permalink Flush or something like that (I think I read something about it on some other forum, whatever...)

    LOL. Cheers!

    UPDATE: For some reason this does not work when you use %postname% structure tag. :/

  4. matthewcarlin
    Member
    Posted 2 years ago #

    I managed to partially fix it by hacking the plugin code.

    I replaced this line:

    static public $default_structure = '/%year%/%monthnum%/%day%/%post_id%/';

    in the plugin file with

    static public $default_structure = '/%year%/%monthnum%/%day%/%post_name%/';

    and that got %post_name% working for me. Not sure if post_id works now though but post_name is probably more useful anyway.

  5. MACscr
    Member
    Posted 2 years ago #

    This doesnt work for me either. I tried your suggestions, but no luck. Is this supposed to be modifying the .htaccess file at all? they seem to be the pretty standard wp ones from what im seeing.

  6. matthewcarlin
    Member
    Posted 2 years ago #

    I'm not sure why mine works for me and not you. This doesn't modify the .htaccess file i don't think. This is what i have in mine -

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    which is the standard WordPress one i believe, i'm using WordPress 3.4 and my permalink rule is as follows:

    /%taxonomy_name%/%postname%/

    What version of WordPress are you using? Maybe the developer can shed some light on why it works for me and not you.

  7. matthewcarlin
    Member
    Posted 2 years ago #

    Also, thinking about it, i assume you refreshed the permalinks after you'd changed the line of code in the plugin? I did that as well.

  8. MACscr
    Member
    Posted 2 years ago #

    Weird. It was working a bit, then stopped working when i decided to change the permalink structure. I have tried resaving multiple times and even removed the htaccess and saved permalinks again and still no difference. I keep getting 404's. This is driving me nuts. I dont get the inconsistency I am having.

    I would gladly do custom permalinks through the functions.php file if i knew a reliable way to do it per custom post type.

  9. matthewcarlin
    Member
    Posted 2 years ago #

    That's pretty weird that it was working then stoppped. What permalink structure were you using and what did it change to? I'll see what i was using.

  10. matthewcarlin
    Member
    Posted 2 years ago #

    You haven't got a page with the same name as the taxonomy either have you? That's been known to cause issues with custom post types and 404's.

  11. MACscr
    Member
    Posted 2 years ago #

    just /%campus%/%postname%/ with %campus% being a taxonomy.

    I have made so many changes in general though lately that I have lost track of things. I currently have the plugin disabled as Im trying to do the rewrites manually through the functions.php file of the site theme and they are working that way for the most part, but for some odd reason i have to flush the rules on every page load (very odd).

    I do know that at one point my CPT was a post type, but not its a page type if that makes any difference. It also is set for hierarchical support.

    I do not have any conflicting page/post names.

  12. damjtoh
    Member
    Posted 1 year ago #

    Same here

  13. MarceFX
    Member
    Posted 1 year ago #

    Another one struggling with the same problem...

  14. BriceLucas
    Member
    Posted 1 year ago #

    I am also having this issue, however would like to mention that I am running NGINX... which I feel may be part of the issue. Any help would be greatly appreciate, would be happy to pay for service as well.

  15. BriceLucas
    Member
    Posted 1 year ago #

    I figured this out. The plugin folder needs to have 777 permissions. Also, if your theme is performing re-writes (as mine was, just open your theme-functions.php file and search "rewrite"). Then try removing all rewrites from the theme as well.

    Note: Be sure to click the "save" button on the permalinks settings page in wordpress after setting your folder permissions to 777.

  16. seogroup
    Member
    Posted 1 year ago #

    Another better solution for this problem, without making the folder to 777 (i have no idear why this could help, it makes you only available to hacker attacks):

    It comes from old rewrite rules in DB (in my case).

    Go to your Database, search in wp_options for (option_name)"rewrite_rules" and empty the "option_value". Save it.

    Go to permalinks (admin) and save your permalinks again.

    Thats it, worked for me.

    ;-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic