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()?
- When to use WP_query(), query_posts() and pre_get_posts
- Posts with at least 3 tags of a list of tags
- How to use the_posts_navigation for wp_query and get_posts?
- WP_Query vs get_posts
- meta_query: using BETWEEN with floats and/or casting to DECIMAL
- Get posts from Network (Multisite)
- How to order by post_status?
- 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 Recent Posts by Date in Multisite
- get_posts with multiple categories
- get_template_part in for loop
- Use of caller_ get_ posts
- Better way to get tag stats?
- How-to exclude terms from the main query the most performant way?
- Given a WP_Query, how can I get a list of tags?
- Executing Queries in tag.php
- Is it possible to select against a post’s parent’s fields with WP_Query?
- Query all posts where meta value is empty
- How to order posts tag by tag?
- post_type is ignored by WP_Query when ‘tag’ argument is included
- WP Rest API v2 return posts with specific tag
- Loop through all tags & output posts in alphabetical list
- Get posts by meta data OR title
- Get_post() with meta_key when compare is a date
- get_posts not finding argument: post_name
- 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?
- Function to check if author has posted within the last x days
- 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
- WP Query post meta value
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- get_posts() seemingly ignoring post_type
- Can not switch the queried post in pre_get_posts hook
- How to find out what “Blog pages show at most” is set to [duplicate]
- Count posts returned by get_posts in external PHP script
- Trying to check and see if a post has a featured image outside of the main loop
- WP_query category__in not working, only pulls from first category
- SELECT * FROM $wpdb->posts WHERE ID > 160
- How to exclude products by tag from woocommerce shop page?
- Pagination problem after WP_Query with tag filtering
- Adding multiple post queries with parent and children to page – Best Way
- get_posts return only first result
- Related posts queries
- How to get meta key list efficiently?
- Order posts by tags count?
- Fix wp_term_relationships slow query in get_posts
- how to get wp_query posts only first letter of alphabet A?
- getting posts by tags
- Search with WP_Query, but ignore href URLs in anchor tags?
- Show posts from categories instead of tags
- get_posts query caching?
- Get posts with any value in attribute
- post_type not working when tag__in is present?
- Related Post by Tags Code
- Exclude all tagged posts from WP_Query loop
- Slow query when selecting with large meta query or post__in
- Getting the last X posts, but in ascending order of time
- WordPress custom query by archive title
- How to create page that lists tags by initial letter?
- 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
- Display posts from catagories
- Both WP_Query and get_posts returning 1 post
- When should you use WP_Query vs query_posts() vs get_posts()?
- 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
- Weird query with get_posts and WP_Query
- orderby and order filter in get_posts or WP_query function in wordpress not working
- tax_query not working properly with get_posts
- Query custom post types by meta field in a term from custom taxonomy
- How to replecate the _fields parameter in custom REST api endpoint
- Get posts that were most recently tagged
- How to retrieve _embed (etc) fields in get_posts custom query?
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Empty query on Custom Post Type, using WP_Query or get_posts
- A Depth Like Parameter For “get_posts”
- Sort by multiple columns using get_posts
- How to cache wordpress get_posts query using transients?
- When to use WP_query(), query_posts() and pre_get_posts
- How do I show related posts from categories instead of tags?
- Equivalent of url_to_postid() for non-post URLs?