There is not a NAND operator for the tax_query of WP_Query. If I understood correctly, what you intend can be rewritten this way:
- Get all the posts without the term
c. - Get all the posts without the term
java. - Exclude the posts having both the terms
candjava.
To achieve that, you can combine two NOT IN queries and match them with an OR:
$args = array(
'post_type' => 'book',
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'language',
'field' => 'slug',
'terms' => array( 'c' ),
'operator' => 'NOT IN',
),
array(
'taxonomy' => 'language',
'field' => 'slug',
'terms' => array( 'java' ),
'operator' => 'NOT IN',
),
)
);
$posts = get_posts( $args );
echo count( $posts );
Related Posts:
- Query/list all terms and their custom post count
- display post count in archive page that have relation with another taxonomy term
- Complex Custom Loop with Includes
- Exclude a category from WP_Query
- $wp_query->queried_object->ID throws warning: Undefined property
- Select All in Parent Category, Group by Child Category?
- get_query_var() not working in pre_get_posts
- query multiple taxonomies
- The Operator “NOT IN” Does Not Work In tax_query
- How to get_queried_object on multiple objects?
- Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)
- How to get the parent’s taxonomy?
- Sort the main query in subcategories/terms?
- Help with hierarchical custom taxonomies and permalinks…almost there
- Custom Taxonomy List links being re-written
- custom post type paging not working past page 3
- Taxonomy list. Order by a specific custom post type count
- Want to filter only parent post in admin area
- Custom Taxonomy and tax_query Issue?
- Get count of custom post type created by current user
- Custom post query by taxonomy
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Optimised Code for Pulling Taxonomy Posts
- Show Post Count of a Category
- WP_Query search posts by custom post type and custom taxonomy
- get_queried_object error How to show post count by month in the taxonomy page
- Count posts with specific term_meta
- Fetch taxonomies by custom post type id array
- Group custom posts by custom taxonomy names
- How can i skip same post from taxonomy term?
- shortcode to show custom post types by category
- Genesis filterable portfolio isotope [closed]
- Wrong request query on cpt and tax
- Get custom taxonomies from multiple posts
- Pagination for Custom Taxonomy Page [duplicate]
- Search / Filter posts on Title/Content OR Tags
- Custom loop with multiple taxonomy queries
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Custom taxonomy rewrite give pagination 404
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Post count by month of taxonmy term
- How can I made custom taxonomies relationship?
- What’s the WP way to load remaining custom posts?
- How to have this permalink structure: post_type/postname/custom_inner_page
- First custom field value (out of several) displayed twice after query
- Advanced search form with filters for custom taxonomies
- Retrieve custom post types by custom taxonomies with WP_Query
- WP the_posts() on single-cars.php get category link
- tax_query not working in template
- Using page slug in wp_query
- Custom taxonomy wp_query woes.
- Creating two loops based on different logic
- Different options per post type in WP_Query
- How to show all taxonomies within custom post type loop
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- how to count the current posts terms
- Trying to add a class to post links
- How to query Posts from a custom post type which contains a custom taxonomy?
- Query Posts that have Custom Taxonomy
- List all Custom Post Type posts excluding certain Taxnomy term
- Foreach loop returning more than one item when querying taxonomy
- Query custom posts from custom taxonomy
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- Sorting the Loop by Taxonomy Value
- custom taxonomy pagination 404 error
- Ordering by meta value not working
- custom post type and a “sticky” position taxonomy
- Display post count for a specific month
- WP_Query to display number of custom post type filtered (order by) taxonomy
- WP_Query for custom taxonomies showing posts from non-specified terms?
- How to show custom post count in archive page
- Live search by custom tag
- Query a custom taxonomy in a function to create an csv file
- Ajax load more inside custom post type taxonomy
- WP Query tax_query not returning posts
- Create a custom wp_query from a specific custom post type with specific taxonomy
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Display all Custom taxonomy terms and their relevant custom posts
- Query pulling all taxonomies, not one I am specifying
- CPT Efficient way to display posts from different categories with custom query
- Get archive of posts separated by taxonomies and subtaxonomies
- Query Pulling the same post twice
- Get posts associated with custom taxonomy alternate way
- Loop with Custom Post Type and Taxonomies
- tax_query showing no results
- Values inside a custom field to determine which category posts to display
- How to display elements of different post types?
- WP Query WordPress Post Type with the same Taxonomy name
- Listing all custom post types using a specific term on the said term’s template page, in groups
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- display custom post type from register taxonomy
- Attaching multiple custom taxonomies to one CPT?
- Get X posts with the same terms as the current post (custom post type and custom taxonomy)
- WP Query Conditionally query meta and taxonomy
- Sort ACF by custom taxonomy
- Dynamically count the number of custom post types associated to a custom taxonomy
- WP_Query not using relation key as expected and not producing any results
- Hide load more button if no more post in selected category
- Custom fields disappearing when a custom post type is assigned