I have custom post type (entertainment) and I set up a taxonomy (review) as hierarchal so there are check boxes under the taxonomy. Most of the post in the entertainment are just post but we also have reviews. What I was hoping is that if it's a review then you can just check what type of review in the review taxonomy box, an example is "movie". I am trying to display the latest review using

query_posts( array('tax_query' => array(array('taxonomy' => 'review','field' => 'slug','term' => 'movie')), 'posts_per_page'=>'1', 'caller_get_posts'=>'1') ); 

But it's showing the latest post and not the one selected as movie.

I'm on WP 3.1


You can do a straight query for the taxonomy term:

query_posts( array( 'review' => 'movie' ) );

To query multiple terms you can use tax_query:

'tax_query' =>     array(
            'taxonomy' => 'review',
            'field' => 'slug',
            'terms' => array( 'movie', 'term', 'term' ),
  • that worked, I'm always trying to do it more complicated than it should be. Now what if I wanted to check multiple terms? I tried 'review'=>array('term,'term,'term') and that didn't work. – kel Feb 26 '11 at 11:00
  • @kel see updated answer – Chris_O Feb 26 '11 at 18:53
  • the second one didn't work for me. – kel Feb 26 '11 at 22:33
  • I got it now it should be 'tax_query' => array(array( 'taxonomy' => 'review', 'field' => 'slug', 'terms' => array( 'movie', 'term', 'term' )) ), – kel Feb 27 '11 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.