WordPress.org

Support

Support » How-To and Troubleshooting » Permalinks keep breaking

Permalinks keep breaking

  • 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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Scott Fennell

    @scofennellgmailcom

    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.

    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?
    Zack

    Scott Fennell

    @scofennellgmailcom

    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?

    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’ )
    )
    );
    }

    ?>

    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

    Scott Fennell

    @scofennellgmailcom

    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.

    vapor99

    @vapor99

    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?

    Scott Fennell

    @scofennellgmailcom

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

    http://codex.wordpress.org/Function_Reference/register_post_type

    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

    http://codex.wordpress.org/Template_Hierarchy#Custom_Post_Types_display

    vapor99

    @vapor99

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Permalinks keep breaking’ is closed to new replies.
Skip to toolbar