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 have the following below which I have used to create a custom post type and a custom taxonomy.

Within the products section I've created the categories "monitors" & "consumables".

I have then created the template taxonomy-monitors.php, is that correctly named for the monitors category? Also what is the url I need to visit to see only the monitors category using that template?

add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'products',
            'labels' => array(
                'name' => __( 'Products' ),
                'singular_name' => __( 'Product' )
        'capability_type' => 'post',
        'supports' => array('title','editor','comments'),   
        'public' => true,
        'has_archive' => true,
        'rewrite' => array( 'slug' => 'products' ),

function news_init() {
    // create a new taxonomy
            'label' => __( 'Product Categories' ),
            'sort' => true,
            'hierarchical' => true,
            'args' => array( 'orderby' => 'term_order' ),
            'rewrite' => array( 'slug' => 'products-category' )
add_action( 'init', 'news_init' );

UPDATE enter image description here

share|improve this question


See the Template Hiearchy for a more detailed break down of how WordPress chooses the template.

For a taxonomy term slug ('monitors' your example) in the taxonomy taxonomy (e.g. 'products') WordPress will try to use the following templates (in this order)


For your 'monitors' taxonomy term page, WordPress will use


if it exists. If it doesn't, then for that taxonomy it will fallback to


and so on.


The following url should point to the 'monitors' products page:


You have also specified an url rewrite, so assuming the rewrite rules have been flushed and there isn't a clash, the following should also work

share|improve this answer
Ok Thanks. I now have a template taxonomy-products-monitors.php, went to the permalinks section and clicked save (that flushes it right?) then went to the page http://www.neurosignsurgical.com/v2/products-category/monitors but it still shows a 404. Really don't understand why! – Rob Aug 15 '12 at 11:20
That does flush it, yes. Keep in mind that terms with now posts will probably display a 'nothing found'. If the first link works find, then its a permalink issue. You should use this plug-in to diagnose it. A template won't effect a 404. – Stephen Harris Aug 15 '12 at 14:00
I've tried adding new products and categorising them as monitors, the first link gave a 404 and so did the second one. Tried the plugin (I'll update the question with a screenshot). – Rob Aug 15 '12 at 14:17
Sounds like you haven't flushed your permalinks. Go to the Settings > Permalinks page and just hit 'Save' again to force an update of the rewrite rules. – Tom Auger Aug 15 '12 at 15:34

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.