Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Custom taxonomy template not showing WordPress


I have my custom taxonomies set up to show like categories do on a post page, but when I click on the custom taxonomy link it directs me to the index.php page instead taxonomy.php. Is there a reason why it wouldn't notice this page?

Here is my code if.

// testimonial custom content type
add_action('init', 'testimonial_register');

function testimonial_register() {

$labels = array(
'name' => _x('Testimonials', 'post type general name'),
'singular_name' => _x('Testimonial', 'post type singular name'),
'add_new' => _x('Add New', 'testimonial item'),
'all_items' => __('All Testimonials'),
'add_new_item' => __('Add New Testimonial'),
'edit_item' => __('Edit Testimonial'),
'new_item' => __('New Testimonial'),
'view_item' => __('View Testimonial'),
'search_items' => __('Search Testimonials'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''

$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 6,
'supports' => array('title','editor','thumbnail'),
'has_archive' => true

register_post_type( 'clientfeedback' , $args );
// testimonial custom taxonomy
add_action('init', 'testimonial_taxonomies', 0);

function testimonial_taxonomies() {

$labels = array(
'name' => _x( 'Testimonial Types', 'taxonomy general name' ),
'singular_name' => _x( 'Testimonial Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Testimonial Types' ),
'all_items' => __( 'All Testimonial Types' ),
'parent_item' => __( 'Parent Testimonial Type' ),
'parent_item_colon' => __( 'Parent Testimonial Type:' ),
'edit_item' => __( 'Edit Testimonial Type' ),
'update_item' => __( 'Update Testimonial Type' ),
'add_new_item' => __( 'Add New Testimonial Type' ),
'new_item_name' => __( 'New Testimonial Type Name' ),
'menu_name' => __( 'Testimonial Types' ),

'testimonial', // internal name = machine-readable taxonomy name
'clientfeedback', // object type = post, page, link, or custom post-type
'hierarchical' => true, // true for hierarchical like cats, false for flat like tags
'labels' => $labels, // the human-readable taxonomy name
'query_var' => true, // enable taxonomy-specific querying
'rewrite' => true // pretty permalinks for your taxonomy?

I should also note that this is the code I'm using to bring up custom taxonomy link.
<?php the_terms( $post->ID, 'testimonial', '<strong>Posted in:</strong> ', ', ', ' ' ); ?>

I have tried the following pages: taxonomy.php, taxonomy-testimonial.php and taxonomy-{taxonomy-categories}.php. None of them are noticed when I click on my taxonomy link above.

Answers (3)


Navjot Singh answers:

Tried saving the permalinks?

get_username comments:

Thanks, Navjot. That seems to have worked. I wasn't sure what you meant at first, but upon further reading I understood that I needed to re-save my permalinks after creating my custom post type and taxonomy.

No where in the Wordpress documentation did I see this stated. Have you? What is the reason for re-saving?


Abdelhadi Touil answers:

Hope this helps you:
[[LINK href=""]][[/LINK]]

and this one too:
[[LINK href=""]][[/LINK]]

Good luck.

get_username comments:

Hi Abdelhadi,

Your first link was helpful, as it made me understand what Navjot meant in his post above. It appears that re-saving permalinks was this issue this time.


John Cotton answers:

Have you tried clicking on the View link next to the tax in the dashboard?

If so, is this the same URL as you are trying from the front end?

John Cotton comments:

Your code looks OK to me - taxonomy.php and/or taxonomy-testimonial.php should both work.

It's something else....I think your priority var on the init action may be messing things up.

Have you tried merging the two functions - put the taxonomy declaration second.

get_username comments:

Hi John,

Thanks for looking at my code. As you can see from my comment to Navjot above, it appears it was a permalinks re-save issue. Even though that looks like the answer, I am curious what you meant by "I think your priority var on the init action may be messing things up." I'd like to make sure my programming is correct. Please explain further if you don't mind.

John Cotton comments:

It's just that, with a priority of 0 here:

add_action('init', 'testimonial_taxonomies', 0);

your taxonomies will get declared before your types.

I never do it that way round, but I've just tried it and it doesn't actually seem to matter.

The reason re-saving worked is that the taxonomy creates a rewrite rule so that your taxonomy permalinks work. Re-saving flushes the rewrite rule list and allows custom types and taxonomies the chance to add their url structure to the list.