Custom Taxonomy template not showing

I’ve spend the better part of a day trying to figure this out. My custom taxonomy shows up in the WordPress admin, I can add it to a nav and display it with wp_nav_menu, but when I click on any of the terms I get a 404 even though I have a taxonomy.php in the theme. Any ideas?

/** Product custom post type **/
add_action( 'init', 'product_post_type' );
function product_post_type() {
  register_post_type( 'product',
    array(
      'labels' => array(
        'name' => __( 'Products' ),
        'singular_name' => __( 'Product' ),
        'add_new_item' => __( 'Add New Product' ),
        'new_item' => __('New Product'),
        'all_items' => __( 'All Products' ),
        'view_item' => __('View Products' ),
        'search_items' => __('Search Products'),
        'not_found' =>  __('No Products found'),
        'not_found_in_trash' => __('No Products found in Trash'), 
        'parent_item_colon' => '',
        'menu_name' => __('Products')
      ),
    'menu_position' => 5,
    'public' => true,
    'taxonomies' => array('product')
    )
  );
}

/** product Taxonomy **/

add_action( 'init', 'create_product_taxonomy' );

function create_product_taxonomy() 
{
  $labels = array(
    'name' => __( 'Product Categories' ),
    'singular_name' => __( 'Product Category' ),
    'search_items' =>  __( 'Search Product Categories' ),
    'all_items' => __( 'All Product Categories' ),
    'parent_item' => __( 'Parent Product Category' ),
    'parent_item_colon' => __( 'Parent Product Category:' ),
    'edit_item' => __( 'Edit Product Category' ), 
    'update_item' => __( 'Update Product Category' ),
    'add_new_item' => __( 'Add Product Category' ),
    'new_item_name' => __( 'New Product Category' ),
    'menu_name' => __( 'Product Categories' ),
  );    

  register_taxonomy('product', array('product'), array(
    'public' => true,
    'hierarchical' => true,
    'labels' => $labels,
    'query_var' => true
  ));
}

Related posts

Leave a Reply

1 comment

  1. Okay, I feel quite silly, but what it comes down to is you can’t have a custom post type and custom taxonomy with the same name. (Well… you can, but your taxonomy templates won’t work) In my case I changed my content type to “product” and my taxonomy to “products”. This fixes everything along with a permalink refresh.