Permalinks keep breaking (10 posts)

  1. vapor99
    Posted 3 years ago #

    ok so i have deactivated plugins, and my site was fine before, but all of a sudden when I make any changes to my site including posts or any setting changes, the links to a particular custom post type break until I go into permalinks and change them to default and then change back to permalinks or vice versa. Is this a common issue that has been found in the past?

    When I hover over the items, the link info in my browser seems correct?

    Any ideas would be great.

  2. Scott Fennell
    Posted 3 years ago #

    What's the slug for the custom post type? If you are trying to use a reserved term like "author" then that could be trouble.

  3. vapor99
    Posted 3 years ago #

    Hey scott,

    Im not sure where to change the slug for this post type. It appeared after I had installed my theme. But I still dont feel that this is the problem since it wouldnt explain why is breaks even after I change something simple in the settings that should not have any affect on URLs for post types?

  4. Scott Fennell
    Posted 3 years ago #

    So... what's the slug for the custom post type? Just paste the code you used to register it. If it came with your theme, it's probably in functions.php.

    Permalink 404's can be tricky to diagnose because they cache, and the most common way to flush that cache is to change your permalink settings.

    Does the problem continue when you switch to a default theme such as 2012?

  5. vapor99
    Posted 3 years ago #

    When I switch back to a 2012 theme this post type is gone because its part of the theme. And nothing else breaks, just these posts under the custom post type Portfolio. So here is the code snippet that creates the custom post type.

    // Add custom post type Portfolio
    add_action('init', 'themezee_add_portfolio');
    function themezee_add_portfolio()
    register_post_type('portfolio', array(
    'label' => __('Portfolio', 'themezee_lang'),
    'public' => true,
    'show_ui' => true,
    'menu_position' => 6,
    'has_archive' => false,
    'rewrite' => array('slug'=>'portfolio-item'),
    'supports' => array('thumbnail', 'title', 'editor' )


  6. vapor99
    Posted 3 years ago #

    Ok so i deactivated then reactivated my theme, all my plugins, and the permalink options once again...and it seems to be fine now. When I make modifications to my site, the custom post type entries dont break, and they stay in the "post-name" permalink structure,

    Thanks for your help scott

  7. Scott Fennell
    Posted 3 years ago #

    As you seem to be aware, permalink 404's can be tricky to wrangle, as they are related to caching. If the problem returns, and it might, try porting the custom post type to 2012 and seeing if you can re-pro there. That'd be the next debugging step.

  8. vapor99
    Posted 3 years ago #

    Thanks again scott,

    How would I go about "porting this custom post type to the 2012 theme?

    add the above PHP function to the 2012 functions.php?

  9. Scott Fennell
    Posted 3 years ago #

    Pretty much. If in doubt, go straight to the source:


    You'll then need to call them on your front end. The easiest way to do that is copy your archive template and rename it to archive-your-cutom-post-type-name-here.php


  10. vapor99
    Posted 3 years ago #

    OK so the problem is back, and again I am not sure why!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.