Title: probleme taxonomy.php
Last modified: August 19, 2016

---

# probleme taxonomy.php

 *  [boddhi](https://wordpress.org/support/users/boddhi/)
 * (@boddhi)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/probleme-taxonomyphp/)
 * Hi, i’m using this to display my taxonomy, everything works fine for the name
   but i don’t have no post displaying under it, i got the ‘Sorry, no posts matched
   your criteria’.
 *     ```
       <?get_header(); ?>
       <? $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
               <div id="container">
                   <div id="content" role="main">
   
                       <h1 class="page-title"><?php
                           printf( __( 'Posts classified under: %s', 'twentyten' ), '<span>' . $term->name . '</span>' );
                       ?></h1>
   
                       <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
   
       <?php the_excerpt(); ?>
       <?php endwhile; else: ?>
       <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
       <?php endif; ?>
                   </div><!-- #content -->
               </div><!-- #container -->
       <?php get_sidebar(); ?>
       <?php get_footer(); ?>
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Chinmoy](https://wordpress.org/support/users/chinmoy/)
 * (@chinmoy)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/probleme-taxonomyphp/#post-1704299)
 * have you register custom taxonomy? or using any plugin?
 * First create a custom taxonomy post and then check once.
 *  Thread Starter [boddhi](https://wordpress.org/support/users/boddhi/)
 * (@boddhi)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/probleme-taxonomyphp/#post-1704306)
 * My custom taxonomy is created already by hand with no plug in
 *     ```
       add_action('init', 'my_custom_init');
   
       function my_custom_init() {
         $labels = array(
           // You can alter the text on any of these
           'name' => _x('Pharmacie', 'post type general name'),
           'singular_name' => _x('Item', 'post type singular name'),
           'add_new' => _x('Add Item', 'Event Item'),
           'add_new_item' => __('Add New Item'),
           'edit_item' => __('Edit Item'),
           'new_item' => __('New Item'),
           'view_item' => __('View Item Details'),
           'search_items' => __('Search Pharmacie Items'),
           'not_found' =>  __('Element non trouve'),
           'not_found_in_trash' => __('No portfolio items found in the Trash with that criteria'),
           'view' =>  __('Voir Item')
         );
   
         $args = array(
           'labels' => $labels,
           // We can give our post type a description in case we forget what its for
           'description' => 'This is the holding location for all pharmacie items',
           'public' => true,
           'publicly_queryable' => true,
           // To keep in the search, or to not keep in the search. That is the question.
           'exclude_from_search' => true,
           'show_ui' => true,
           'rewrite' => true,
           'hierarchical' => true,
           'menu_position' => 5,
           'supports' => array('title', 'editor', 'thumbnail', 'custom-fields', 'revisions')
         );
   
         register_post_type('pharmacie',$args);
       }
   
       // Register References taxonomy
       $labels = array(
         'name' => _x( 'References', 'taxonomy general name' ),
         'singular_name' => _x( 'Reference', 'taxonomy singular name' ),
         'search_items' =>  __( 'Search references' ),
         'popular_items' => __( 'References' ),
         'all_items' => __( 'Tous' ),
         'parent_item' => __( 'Parent References' ),
         'parent_item_colon' => __( 'Parent reference:' ),
         'edit_item' => __( 'Editer References' ),
         'update_item' => __( 'Mettre a jour' ),
         'add_new_item' => __( 'Ajouter nouvelle reference' ),
         'new_item_name' => __( 'New reference Name' )
       );
   
       register_taxonomy('xyz',array('pharmacie'), array(
         // Make sure you set hierarchical to true
         'hierarchical' => true,
         'labels' => $labels,
         'show_ui' => true,
         'query_var' => true,
         // You can rename the slug to whatever you like, just make sure its unique
         // Make sure you remember what it was because you'll need it later
         'rewrite' => array( 'slug' => 'xyz' )
       ));
       ```
   
 *  Thread Starter [boddhi](https://wordpress.org/support/users/boddhi/)
 * (@boddhi)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/probleme-taxonomyphp/#post-1704312)
 * Ok i made a new “taxotest” taxonomy in my **post** and not in my custom field“
   pharmacie” and like this it works. how can i fix it to make it work for my **
   xyz** taxonomy, thanks
 *  [Chinmoy](https://wordpress.org/support/users/chinmoy/)
 * (@chinmoy)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/probleme-taxonomyphp/#post-1704313)
 * `'rewrite' => array( 'slug' => 'xyz' )` would be true or false
 *  Thread Starter [boddhi](https://wordpress.org/support/users/boddhi/)
 * (@boddhi)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/probleme-taxonomyphp/#post-1704326)
 * i don’t understand how to make it true or false
 *  Thread Starter [boddhi](https://wordpress.org/support/users/boddhi/)
 * (@boddhi)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/probleme-taxonomyphp/#post-1704354)
 * i tried with
    ‘rewrite’ => array( ‘slug’ => ‘xyz’,’with_front’ => false ) and‘
   rewrite’ => array( ‘slug’ => ‘xyz’,’with_front’ => true ) nothing changed my 
   taxonomy works when it’s in my post section but not when it’s in my custom field
 *  Thread Starter [boddhi](https://wordpress.org/support/users/boddhi/)
 * (@boddhi)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/probleme-taxonomyphp/#post-1704504)
 * A little up, i’m still stuck with this, thanks

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘probleme taxonomy.php’ is closed to new replies.

## Tags

 * [customfield](https://wordpress.org/support/topic-tag/customfield/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [boddhi](https://wordpress.org/support/users/boddhi/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/probleme-taxonomyphp/#post-1704504)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
