Support » Fixing WordPress » Custom taxonomy template not showing

  • 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?

Viewing 6 replies - 1 through 6 (of 6 total)
  • I just read that I should have

    'has_archive' => true

    set in my function and so I did set this. Unfortunately, this did not fix the problem.

    I’ve also made sure that my custom post_type name is all lowercase and no spaces or dashes. My custom taxonomy is also all all lowercase and single word.

    Here is my code if you think that will help. Any ideas you might have is greatly appreciated. This is the last portion of the site and then I’m done.

    // 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> ', ', ', ' ' ); ?>

    Could this have anything to do with it?

    Looks a little confusing. You have a post type called Testimonials as well as taxonomy.

    I think you’re meaning to use the post type to show these, rather than the taxonomy. In that case you might want to try the archive.php template, or more specifically the archive-clientfeedback.php template.

    Hey Steven. I agree my nomenclature could have been a little better, and I have a page called Testimonials to add to that.

    From what I can see, I have a post type label named Testimonials(plural) and Testimonial(singular). The actual post type name is “clientfeedback”. My taxonomy is called “testimonial.”

    Clear as mud, right? I can get my posts to show on my Testimonials page, it’s the taxonomy link that does not work. So I believe I do need the taxonomy page. It’s the same as when you click on a category link when browsing a standard blog. You click the category that the post is associated with, and you’re taken to /category/%postname%. In my case, I’m looking for /taxonomy/%postname%.

    UPDATE: After posting this question on another forum, someone mentioned that I needed to re-save my permalinks again. I did this, and so far this has worked. A little more testing is needed, but I think this might have been part of a problem I was not even aware of. Has anyone heard of this? Where does WordPress documentation state that you need to “save permalinks after creating a custom taxonomy?”

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom taxonomy template not showing’ is closed to new replies.