Reputation: 57
I want to count taxonomy posts by those filters:
"show" post type only
Custom field of "done" value = no
Taxonomy "comedian", Term ID 2 only
Here is my code:
<?php
$args = array(
'post_type' => 'show',
'meta_key' => 'done',
'meta_value' => 'no',
'taxonomy' => 'comedian',
'field' => 'term_id',
'terms' => '2',
);
$myquery = new WP_Query($args);
echo "Found: $myquery->found_posts";
?>
This code filter well "shows", "done" and "comedian" but its not filter for Term ID 2 only... What I did wrong with my code?
Upvotes: 1
Views: 728
Reputation: 11388
See the documentation you should have something like this:
$args = array(
'post_type' => 'show',
'meta_key' => 'done',
'meta_value' => ''.$overyet.'',
'tax_query` => array(
'taxonomy' => 'comedian',
'field' => 'term_id',
'terms' => 2
)
);
Upvotes: 1