1 of 2
Mihir
  • 121
  • 1
  • 10

Hey guys somehow this helped me to get count of NAND operation. Because I dont need ti iterate through those posts, I used found_posts of WP_Query . Subtracting my posts count from total post count.

I'm still waiting for a better way if any. Thanx Luis.

$myargs=array(
'posts_per_page' => -1,
'tax_query' => array(
        'relation' => 'AND',
        array(
            'taxonomy' => 'author',
            'field'    => 'slug',
            'terms'    =>  $author_terms //array of author term slug(s),
            'operator' => 'IN'  //default operator ?

        ),
        array(
            'taxonomy' => 'language',
            'field'    => 'slug',
            'terms'    => $language_terms //array of language term slug(s)
            'operator' => 'AND' 
        )
    ),
'post_type' => 'apk');

$allargs=array(
'posts_per_page' => -1,
'tax_query' => array(
        array(
            'taxonomy' => 'author',
            'field'    => 'slug',
            'terms'    =>  $author_terms //array of author term slug(s),
            'operator' => 'IN'  //default operator ?

        )
    ),
'post_type' => 'apk');

$myquery=new WP_Query($myargs);
$allquery=new WP_Query($allargs);

echo allquery->found_posts - $myquery->found_posts;
Mihir
  • 121
  • 1
  • 10