WordPress.org

Ready to get started?Download WordPress

Forums

Permalinks keep breaking (10 posts)

  1. vapor99
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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?
    Zack

  4. Scott Fennell
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

    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

  10. vapor99
    Member
    Posted 1 year 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

Tags

No tags yet.