i have a custom post type name 'business' and taxonomy 'business-category'. now i want to show posts for some specific terms suppost, term1, term2, term3 etc. The following code is working for me but for only one term.
$args=array(
'taxonomy' => 'business-category',
'term' => 'term1',
'post_type' => 'business',
'orderby'=> 'rand',
);
query_posts($args);
I need to pass array of terms. When i try to pass array of terms instead of one term it not working :(
$args=array(
'taxonomy' => 'business-category',
'term' => array('term1', 'term2', 'term3'),
'post_type' => 'business',
'orderby'=> 'rand',
);
query_posts($args);
I also want to know how can i show post if i want to show from multiple taxonomy as well.
Thanks!
Resolved:
the query args will be:
$args=array(
'tax_query' => array(
array(
'taxonomy' => 'business-category',
'field' => 'slug',
'terms' => array( 'bars', 'restaurants' )
)
);
Thanks!