You would want to use the NOT EXISTS
operator along with passing the taxonomy slug, which tells the query not to include any of a chosen category from your custom taxonomy inside the loop.
To exclude all posts that are in the taxonomy “fruit” (regardless of fruit kind), here is the snippet:
$args = array(
'post_type' => 'post',
'tax_query' => array(
array(
'taxonomy' => 'fruit',
'operator' => 'NOT EXISTS'
)
)
);
$query = new WP_Query( $args );
Related Posts:
- Using WP_Query and Query_post for the loop?
- Using WordPress to make a “Product Search” type navigation drilldown
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- display posts with same taxonomy term
- Including all terms in wordpress tax_query
- Display one post from each term in a custom taxonomy [closed]
- search query within custom taxonomy term, post title and meta field
- Advanced Tax Query
- Query for posts in 2 taxonomies
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- How do I Use Multiple Loops with WP_Query?
- cannot get multiple loops using tax_query
- Exclude taxonomy term from all loops, but having it on widget
- Loop through custom taxanomy in post and display custom fields from posts
- How do I stop the same post showing multiple times in a archive?
- Group posts in a category based on tags in custom taxonomy
- Custom Taxonomy + JQuery Tabs
- Loop posts without any taxonomy
- Display all posts that use a custom taxonomy
- Set tax_query conditionally with new WP_Query
- querying posts by custom taxonomy terms right from a querystring based URL
- Custom taxonomy.php not working
- How do I rewrite this loop as a new WP_Query style-loop?
- How to make WP_Query not to show irrelevant posts?
- Query custom taxonomy by term id?
- Include current post into loop
- Filter Custom Taxonomy Posts
- How to get post ID in a Page?
- If Custom Taxonomy
- How to provide meta_key array to wp_query?
- How can I reduce amount of ifs and else ifs in this specific block of code?
- Returning One custom taxonomy term name
- When filtering query on custom taxonomy; main menu dissapears
- get_posts output always same post
- Control content before and after custom post type loop
- Why can’t I use an array of term slugs in WP_Query?
- wp_query not resetting, last post hanging
- Pagination on category.php and tag.php not working
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- How to get posts published on the latest date?
- Problem with wordpress pagination
- How to write sql query to get the posts from a custom taxonomy term name
- How to create custom query by keyword in post title?
- How to do a particular wp_query taxonomy search
- How to make posts unqueryable/unpublish posts where ACF relationship field is an unpublished post? [closed]
- Conditional operator OR not working with custom fields
- Get posts that do not have the same tags as current
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- sort Posts by custom user filed
- WordPress custom post type
- Loop with Custom Post Type and Taxonomies
- display news with pictures 3 small and one large (loop)
- How to get name of custom taxonomy
- Query pages by child term
- Post data in separate divs with incrementing class using WP_Query
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- How do you move custom fields to custom taxonomies using WP Queries
- WordPress hiding posts without content on custom taxonomy query. How to solve?
- Run next query based on first query’s term
- Query Number of Loaded Posts in Loop
- Get the original menu item name string instead of the label
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Order posts with custom taxonomy array
- Adding a category at even positions on main loop with modified pagination
- Trying to achieve row posts below category with multiple loops in custom tax
- Converting an existing query_posts to WP_Query
- Getting grandchildren of a post with a specified custom taxonomy?
- Taxonomy Parameters in WP Query to get posts from two different taxonomies
- WordPress show posts from children terms of a taxonomy term
- Advanced AND tax_query in sidebar with 2 taxonomies
- Transfer taxonomy to custom field
- Multiple loop for “featured” items returns wrong posts
- How to query posts that are not related to any term of a taxonomy?
- Using wp_query is it possible to orderby taxonomy?
- How to limit posts to 1 from each term with tax_query?
- Catergory args causing loop not to show
- Loop custom post type by taxonomy (Category)
- How do I query multiple specific posts from a custom taxonomy?
- Can you orderby slug in a taxonomy archive page using WP_Query?
- query_posts problem – need help
- query posts returns 10 records
- Get custom taxonomy value of post and output posts in same taxonomy
- How do I correctly query posts from a post ID?
- Pagination in category.php not functioning
- display custom post type from register taxonomy
- How to exclude certain portfolios from a loop
- tax_query not working properly with get_posts
- Getting taxonomies specific to categories
- How much worse is querying custom fields compared to custom taxonomies, quantitatively
- Group custom taxonomies based on tags contained in their posts
- How do I create a term for every value of a post meta?
- How home my code doesn’t display any feature image? Looping through post from a taxonomy and not getting feature images back
- How to looping taxonomy terms?
- Show number of posts AND number on current page (cannot make it work)
- How to show to show post list under the specific category name using jetengine query?
- Complex Custom Loop with Includes
- How do I exclude the current post from the upcoming post query
- Adding a language rule and displaying posts with a custom taxonomy term on its archive page
- ACF – How to get custom taxonomy term image field
- Grouping posts by 2 different taxonomies