List posts only of specific terms from a custom taxonomy for wordpress
-
$post_type = 'ba-pet'; $tax = 'status_ba'; $tax_terms = get_terms($tax); if ($tax_terms) { foreach ($tax_terms as $tax_term){ $args=array( 'post_type' => $post_type, 'tax_query' => array(array('taxonomy' => 'status_ba', 'field' => 'slug', 'terms' => array('available','pending'))), "$tax" => $tax_term->slug, 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); [...]
The above code is what I have setup so far… I’m wanting to pull back posts from my taxonomy (status-ba) that has 5 terms in it, I only want to pull back a certain 2 taxonomies (available & pending).
Currently it’s only pulling back ‘pending’, I have a post with ‘pending’ and one with ‘available’ statuses, so it should be pulling back both.
What am I missing?
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘List posts only of specific terms from a custom taxonomy for wordpress’ is closed to new replies.