-1

I have a query that displays the posts of a taxonomy.
the only (and big) problem is: it displays the posts from the child taxonomies of this taxonomy too...

how do I exclude this posts from being displayed outside their immediate taxonomy?

this is my code: http://www.codeshare.io/4jxGt

gargi
  • 249
  • 1
  • 8
  • 17

1 Answers1

0

You can use tax_query for this purpose:

<?php query_posts(array( 
    'post_type'=>'products', 
    'tax_query' => array( 'include_children' => false ), 
    'product-category' => $term->slug, 'posts_per_page' => -1 )); ?>

http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

Heri Hehe Setiawan
  • 1,535
  • 1
  • 12
  • 19