WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to list all the products tied to a specific taxonomy. For some reason the template won't work when trying to access "http://www.myexample.com/product_categories/funiture/", I tried taxonomy.php, taxonomy-term.php and nothing. Here's my code: http://pastie.org/7934453

add_action('init', 'register_cpt_product');

function register_cpt_product() {

    $labels = array(
        'name' => _x('Products', 'product'),
        'singular_name' => _x('Product', 'product'),
        'add_new' => _x('Add New Product', 'product'),
        'add_new_item' => _x('Add New Product', 'product'),
        'edit_item' => _x('Edit Product', 'product'),
        'new_item' => _x('New Product', 'product'),
        'view_item' => _x('View Product', 'product'),
        'search_items' => _x('Search Products', 'product'),
        'not_found' => _x('No products found', 'product'),
        'not_found_in_trash' => _x('No products found in Trash', 'product'),
        'parent_item_colon' => _x('Parent Product:', 'product'),
        'menu_name' => _x('Shop', 'shop'),

    $args = array(
        'labels' => $labels,
        'hierarchical' => false,
        'supports' => array('title', 'editor', 'thumbnail', 'custom-fields', 'revisions', 'page-attributes'),
        'taxonomies' => array('Product Categories'),
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'menu_position' => 20,
        'show_in_nav_menus' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'has_archive' => true,
        'query_var' => true,
        'can_export' => true,
        'rewrite' => true,
        'capability_type' => 'post'

    register_post_type('product', $args);

add_action('init', 'register_taxonomy_product_categories');

function register_taxonomy_product_categories() {

    $labels = array(
        'name' => _x('Product Categories', 'product_categories'),
        'singular_name' => _x('Product Category', 'product_categories'),
        'search_items' => _x('Search Product Categories', 'product_categories'),
        'popular_items' => _x('Popular Product Categories', 'product_categories'),
        'all_items' => _x('All Product Categories', 'product_categories'),
        'parent_item' => _x('Parent Product Category', 'product_categories'),
        'parent_item_colon' => _x('Parent Product Category:', 'product_categories'),
        'edit_item' => _x('Edit Product Category', 'product_categories'),
        'update_item' => _x('Update Product Category', 'product_categories'),
        'add_new_item' => _x('Add New Product Category', 'product_categories'),
        'new_item_name' => _x('New Product Category', 'product_categories'),
        'separate_items_with_commas' => _x('Separate product categories with commas', 'product_categories'),
        'add_or_remove_items' => _x('Add or remove product categories', 'product_categories'),
        'choose_from_most_used' => _x('Choose from the most used product categories', 'product_categories'),
        'menu_name' => _x('Product Categories', 'product_categories'),

    $args = array(
        'labels' => $labels,
        'public' => true,
        'show_in_nav_menus' => true,
        'show_ui' => true,
        'show_tagcloud' => false,
        'show_admin_column' => false,
        'hierarchical' => true,
        'rewrite' => true,
        'query_var' => true

    register_taxonomy('product_categories', array('product'), $args);
share|improve this question
In your case the template would be taxonomy-product_categories.php. If if's not working, go to your taxonomy page in admin, click on "view" for any custom taxonomy, check URL and in the source, the classes on the <body> tag, it will help you to check what kind of page WP thinks you're on. – Simon May 20 '13 at 13:59
When you view the page, what does the body class say? – Tom J Nowell May 20 '13 at 14:19
up vote 2 down vote accepted

Take a look at the Codex:

  • taxonomy-{taxonomy}-{term}.php - If the taxonomy were sometax, and taxonomy's term were someterm WordPress would look for
    taxonomy-sometax-someterm.php. In the case of Post Formats, the
    taxonomy is 'post_format' and the terms are post-format-{format}.
    i.e. taxonomy-post_format-post-format-link.php
  • taxonomy-{taxonomy}.php - If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php
  • taxonomy.php

You registered your taxonomy as product_categories, so you should be using taxonomy-product_categories.php to create a template for all terms in that particular taxonomy.

Use taxonomy-product_categories-furniture.php to target only the one term referenced in your URL.

taxonomy.php will be used for all taxonomies.

share|improve this answer
Taxonomy.php doesn't even work, the theme outputs index.php instead for some reason.. is this normal? – user990717 May 20 '13 at 14:00
It is not normal. It sounds like something is broken. Do you have this problem with any other theme, like Twenty Twelve? – s_ha_dum May 20 '13 at 14:04
Very helpful thanks, at the end of the day I needed to reset my permalinks ;) – user990717 May 20 '13 at 14:22

Did you save the permalink after creating custom post type

Take a look at codex Custom Post Type Templates

share|improve this answer
This fixed it, thanks. I remember having todo this in the past but it's been awhile since I last played around with WP's tax. – user990717 May 20 '13 at 14:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.