Is slug “type” reserved and can’t be used in taxonomy rewrite?

I desperately need your help guys. I am trying to register custom post type and taxonomy the following way:

add_action( 'init', 'product_catalog' );
add_action( 'init', 'product_type', 0 );

function product_catalog() {
    $labels = array(
        'name'               => _x( 'Catalog', 'post type general name' ),       
        'menu_name'          => 'Catalog'
    );
    $args = array(
        'labels'        => $labels,
        'description'   => 'Catalog',
        'public'        => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,       
        'capability_type' => 'post',
        'hierarchical' => false,       
        'menu_position' => 5,
        'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
        'has_archive'   => true,
        "rewrite" => array(       
            'with_front' => false,                       
            'slug' => 'catalog'           
        )
    );
    register_post_type( 'product_catalog', $args );

}


//taxonomy that wont work with first parent, all childs work just fine.

function product_type(){

    register_taxonomy("product_type", array("product_catalog"), array(
    "hierarchical" => true,
    "label" => "Types",
    "singular_label" => "Type",
    "show_ui" => true,       
    'show_admin_column' => true,
    'query_var' => true,
    "rewrite" => array(       
        'slug' => 'type',           
        'with_front' => false,
        "hierarchical" => true
        )
    ));   


}

It seems to show in the panel and I can add hierarchical taxonomies under the TYPE but the problem comes if I try to go to url like: sitename.com/type/parent it always returns 404 not found. At the same time I can go to childs of TYPE and it loads just fine like: sitename.com/type/parent/child

Read More

If I change the ‘slug’ => ‘type‘ to anything else like: ‘types’ then it works 100%.

I don’t get it, why this is happening, is it reserved for something?

I would appreciate your help.

Thank you.

Related posts

2 comments

  1. I can’t quite wrap my head around this without being able to use the code myself, but I have had issues like this. In my experience, it’s been a clash of a taxonomy/page title/taxonomy/term that cause rewrite issues/404’s etc. You could flush your permalinks and revisit the pages, but the what you said about “Type” and “types” makes me think this is a conflict.

Comments are closed.