WordPress Count Taxonomy Posts + Filters

I want to count taxonomy posts by those filters:

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?

Related posts

1 comment

  1. 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
                      )
    );
    

Comments are closed.