A WP_Query
where 'tax_query'
has all tag terms and operator ‘NOT IN’:
$tags = get_terms('post_tag', array('fields'=>'ids') );
$args = array(
'post_type' => 'post',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'post_tag',
'field' => 'id',
'terms' => $tags,
'operator' => 'NOT IN'
)
)
);
$untagged = new WP_Query( $args );
Related Posts:
- I cannot get tax_query in get_posts() to work with custom taxonomy
- When should you use WP_Query vs query_posts() vs get_posts()?
- WP_Query vs get_posts
- Get posts from Network (Multisite)
- Using get_posts vs. WP_Query
- Delete all posts from WordPress except latest X posts
- Sanitation needed for WP_Query or get_posts calls?
- Differences Between WP_Query() and get_posts() for Querying Posts?
- get_posts with multiple categories
- Use of caller_ get_ posts
- How-to exclude terms from the main query the most performant way?
- How to order posts tag by tag?
- WP Rest API v2 return posts with specific tag
- Loop through all tags & output posts in alphabetical list
- Meta Query with date and time on the same Day before given time
- Get posts with condition on comment meta value
- Order posts by tags count?
- Use post__in and post__not_in together?
- What should I use, get_posts or wp_query for less CPU load?
- Different Results with query(‘s=computer’) vs get_posts(‘s=computer’)?
- How to get post from all Blog Multisite to the Main Site?
- How to get any tag ID
- get_posts() seemingly ignoring post_type
- Can not switch the queried post in pre_get_posts hook
- Count posts returned by get_posts in external PHP script
- WP_query category__in not working, only pulls from first category
- SELECT * FROM $wpdb->posts WHERE ID > 160
- Pagination problem after WP_Query with tag filtering
- Adding multiple post queries with parent and children to page – Best Way
- How do you Query posts with nothing in common?
- WP_Query, tax_query and term_meta: How to?
- get_posts – get all posts by array of author
- Create a sitemap without a plugin – get parent pages only?
- Creating a custom search for a specific post type
- get_posts – find out if querystring was crap and fallback is used
- get_posts() not working with multiple statuses
- Return only post(s) which have post_excerpt
- Include tags in WP_Query
- Search for multiple tags?
- Help with WP_Query – Too many mySQL queries
- WP_Query() and get_posts() can’t handle over a thousand posts?
- How can I make WP_Query get posts that have a tag but also have random other tags?
- Cluster WooCommerce products in each Category Archive by Tags assigned to products
- Query posts intersecting tags and categories
- WP_Query post_parent parameter always returns children of current page
- How to count posts with specific arguments
- Check return value of get_posts
- Order by most used tag
- WP Query with multiple tags by get the tags
- Query post with meta value in set of values
- get_posts output always same post
- Use WP_Query or query_posts() or get_posts() for optimizing a site?
- get_posts() and global variables
- complex get_posts() query to select child pages
- Get posts that do not have the same tags as current
- exclude product with available tag
- Using get_posts to get posts based on a checkbox value with Advanced Custom Fields
- Posts query according to meta box date
- How to get posts by category and by choosing a taxonomy term?
- Function using get_posts() with tax_query not working when called from functions.php
- Get posts with no tags?
- get_posts query matches too many results
- Search for pages with permalink
- How to query for a page, get data, then query for child pages of that page
- Execute PHP function inside the admin area
- Prioritising and Ordering Posts By Category Name Using A Custom Loop
- Filter products on category AND tag
- get_posts query is taking about 40 seconds to execute
- Only show tag with the same id as the post
- Populate select list with meta values from all posts of a Custom Post Type
- Form checkbox value going to dynamic URL
- Get posts that match defined arrays of tags
- get_posts return only first result
- How to get meta key list efficiently?
- Order posts by tags count?
- how to get wp_query posts only first letter of alphabet A?
- getting posts by tags
- Show posts from categories instead of tags
- get_posts query caching?
- Related Post by Tags Code
- Getting the last X posts, but in ascending order of time
- WordPress custom query by archive title
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Random posts in WP_Query when searching by tag
- Ordering Posts by parent category, name ascending
- Use not custom fields in get_posts() meta_query?
- Mathematical operations on custom field values? (updated)
- Issue attempting a wp_query_posts with tags
- get_posts works but new wp_query doesn’t
- Why WP_Query in functions.php is not working when get_posts works?
- Retrieve posts in custom post type and specific taxonomies
- Query specific number of posts for each post type in specific order
- Limit Tags display and ad Drop Down Menu
- Can’t seem to get an else statement correct? [closed]
- get_posts shows current post, not defined posts with args
- How to replecate the _fields parameter in custom REST api endpoint
- Get posts that were most recently tagged
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Sort by multiple columns using get_posts
- How to cache wordpress get_posts query using transients?