You cannot use the same object of WP_Query twice. Therefore you need to create another one with a tax_query parameter to fetch posts which are not assigned to any term.
//fetch all reviews which have no assigned term in 'review-product'
$taxonomy = 'review-product';
$post_type="reviews";
$args = [
'post_type' => $post_type,
'tax_query' => [
[
'taxonomy' => $taxonomy,
'terms' => get_terms( $taxonomy, [ 'fields' => 'ids' ] ),
'operator' => 'NOT IN'
]
]
];
$query = new \WP_Query( $args );
The idea is to fetch a list of all terms of your taxonomy and pass them as argument to your tax-query with the NOT IN operator.
The second loop in your example should walk over the new WP_Query object.
Related Posts:
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Check if a post has term inside loop
- display ACF repater field in archive page
- Display posts the match taxonomy term linked from wp_list_categoies?
- List taxonomy terms plus their latest post ordered by post date
- Get array of current post term ID’s
- Function get_queried_object() return NULL in custom taxonomy
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- List custom taxonomy terms sharing posts with a term from a second custom taxonomy
- How to Filter Posts by Custom Fields?
- How to order posts by title after they have already been sorted by category
- Search form not working with custom query?
- Post loop for all taxonomy terms
- Custom taxonomy.php not working
- Filter Custom Taxonomy Posts
- How to add custom meta to ‘pre_get_terms’?
- get term id from term name
- WP_Query to output chosen term and posts with no term assigned
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- How to print term name inside wp post loop
- Query Taxonomy By Page Title
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- How do I stop the same post showing multiple times in a archive?
- Get categories within specific term
- How to define a custom hierarchy for terms?
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- tax_query not working properly with get_posts
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Display all posts in a custom post type, grouped by a custom taxonomy
- Get post count of current loop when using multiple queries on one page
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- display posts with same taxonomy term
- get_template_part in for loop
- “pre_get_posts” firing on every query
- Show two random posts from custom post type
- Add the “active” class only to the first loop item in a WordPress query [closed]
- Counting number of posts with Category B in Category A
- Loop inside the loop
- cloning a WP_Query
- How to query ‘posts_per_page’ to display a different blog posts index template?
- How is WP_Query connected to WP_Post in The Loop?
- Get posts for last working week in WP_Query
- query user display_name failed in a custom mysql query foreach
- Query with custom taxonomy not working
- Query posts by specific word on title
- Filter by custom taxonomy slug on a custom post type
- Multiple taxonomy And acf filter group by
- Reset postdata to custom query in nested queries
- Loop Split two Columns
- How do I rewrite this loop as a new WP_Query style-loop?
- 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?
- Trying to retrieve random post, getting a page
- Exclude taxonomy term from all loops, but having it on widget
- get_the_terms – but only show 4 Posts
- Meta query compare for ID’s greater than specific ID
- display posts of custom post type with custom taxonomy
- PHP – Loop custom post type categories within jQuery Tabs
- WP_Query with one category in args shows other categories
- Ordering posts by custom field and grouped by month
- Wp_query…a type of term a different div
- relation OR instead of AND – Filtered term ID’s in loop
- Compare “Main” post ID to ID inside wp_query loop
- Cant’ Display Custom Post Type Title Base on Tax Terms
- How to break up php code to avoid echo
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Why does apply_filters behave different inside and outside a loop?
- Custom template for password protected page
- problem with the loop
- Function the_posts_pagination() not compatible with WP_Query arguments
- Prevent Duplicate Post Counted by Query
- Save queried result into database
- wp_set_object_terms() custom taxonomy not working correctly when using insert post
- How to show specify category template for both parent and child category
- Pagination inside the blog page not working
- Woocommerce featured products query no longer working
- Custom Query Pagination not working on static front page
- query all posts published by certain user id
- Adding additional taxonomies to wordpress taxonomy page
- modifying the loop multiple times with arguments passed through ajax to wp_query
- WP_Query causing links to not work
- Query Top Set Custom Taxonomy In Given Timeperiod
- Retrieving category pages from subcategory returns empty sets
- Get newest value of an array
- Filter custom post type by custom taxomony
- Iterate through ID’s in loop
- Loop through multiple custom fields with increasing number
- Different number of posts showing in development vs production server
- An archive page without post format (just standard post)
- Pull Instagram images into an existing loop?
- Multiple loop for “featured” items returns wrong posts
- Pagination in custom query not working [duplicate]
- query_posts problem – need help
- How to write a query-function as a query-shortcode?
- First post outside of loop, homepage only?
- Show number of posts AND number on current page (cannot make it work)
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Display Featured image from custom post type category (custom taxonomy) wise
- has_term not returning anything