I have a custom post type "book", and a taxonomy "language" with terms "php" , "java" ,"c", "python". I want to count "book" posts not having terms "java" & "c".. such that posts with only "java" or "c" should be counted but posts with both "java" and "c" should not be counted. I tried tax_query of WP_QUERY using operator "NOT IN" and "=" but haven't got correct answer. There should be "NAND" operator for tax_query.
P.S : I have approx 20 terms and 200 posts for each. With this tax_query I have added 1 AND tax_query also and that is for other taxonomy term.
$myargs=array(
'posts_per_page' => -1,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'author',
'field' => 'slug',
'terms' => array( 'ABC', 'XYZ' ),
),
array(
'taxonomy' => 'language',
'field' => 'slug',
'terms' => array( "c", "java"),
'operator' => 'NOT IN',
),
),
'post_type' => 'book');
A book may have one or more language terms.