Support » Fixing WordPress » CPT conflicting with Page Slug

  • Resolved sparklogix


    I know, they can’t be the same. I’ve changed the CPT name and slug, but the page slug is still adding -2 to the end.

    This is my CPT code in the functions.php file:

    $labels = array(
        'name' => _x('Portfolio Item', 'post type general name'),
        'singular_name' => _x('Portfolio Item', 'post type singular name'),
        'add_new' => _x('Add New', 'portfolio-item'),
        'add_new_item' => __('Add New Portfolio Item'),
        'edit_item' => __('Edit Portfolio Item'),
        'new_item' => __('New Portfolio Item'),
        'all_items' => __('Portfolio Items'),
        'view_item' => __('View Portfolio Item'),
        'search_items' => __('Search Portfolio Items'),
        'not_found' =>  __('No portfolio items found'),
        'not_found_in_trash' => __('No portfolio items found in Trash'),
        'parent_item_colon' => '',
        'menu_name' => 'Portfolio'
      $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'query_var' => true,
        'rewrite' => array('slug'=>'portfolio-item','with_front'=>false),
        'capability_type' => 'post',
        'has_archive' => true,
        'hierarchical' => false,
        'menu_position' => 5,
        'supports' => array( 'title','editor','thumbnail','excerpt','custom-fields' ),
      register_post_type( 'portfolio-item', $args );

    The CPT and CPT slug was originally “portfolio” but I change all that. However, when I try to edit the page slug of the Portfolio page it looks like this: /portfolio-2

    I do not have any other pages in the trash with the /portfolio slug, all have been permanently deleted. What am I missing that is causing the page slug to not work? It’s driving me crazy, and I can only assume that it’s something simple that I’m overlooking.

    Thanks so much for any help 🙂

Viewing 1 replies (of 1 total)
  • Solved it. Missed the slug for portfolio_is_bad_hierarchical_slug in the functions.php file. I knew it was something quick and easy…

Viewing 1 replies (of 1 total)
  • The topic ‘CPT conflicting with Page Slug’ is closed to new replies.