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?
See the documentation you should have something like this: