Pass the post ID from the first query as a post__not_in
parameter to exclude it from the second query.
$nature_loop_1 = new WP_Query(
array (
'category_name' => 'nature',
'tax_query' => array (
array (
'taxonomy' => 'highlight',
'field' => 'slug',
'terms' => 'sidebar-highlight',
'operator' => 'IN'
)
),
)
);
$exclude = $nature_loop_1->post->ID;
$nature_loop_2 = new WP_Query(
array (
'category_name' => 'nature',
'post__not_in' => array( $exclude )
)
);
Related Posts:
- have_posts() return false but count says “3”
- Get posts that matches specific terms of multiple custom taxonomies
- Using get_term() in functions.php results in Invalid taxonomy error
- Displaying terms based on loop posts?
- Show posts without term
- display posts with same taxonomy term
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- Display posts the match taxonomy term linked from wp_list_categoies?
- Why is my WP_Query not working when tax_query terms are an array?
- WordPress category & taxonomy loop with pagination
- Move posts to top of WP_Query if in certain Taxonomy?
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Display certain amount of posts on taxonomy archive page
- List all custom post type posts from a given category?
- Filtering posts by multiple taxonomies
- How to Loop within a Loop (Display Children and then Grandchildren)
- How to add terms to my tax_query based off of the current post
- Generating dynamic Tabs with multiple query post loop
- Adding active/current class to get_terms list
- Pass array of taxonomy terms to wp_query
- Get taxonomy terms only of the WP_Query current posts
- Prevent duplicate post from dynamic multiple loops
- Formulate a url to show posts with both taxonomy terms
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- How can I modify the loop from a plugin without wiping out other filters?
- Order by slug in get_terms with multiple taxonomies
- Function get_queried_object() return NULL in custom taxonomy
- Avoid duplicate post from same Taxonomy
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- How to return only one instance of each, from the entire loop
- Query last updated posts (posts updated in the last 24 hours)
- I write simple wordpress loop for taxonomy.php file but don’t show result
- Get authors by term id or slug
- Custom post taxonomies as tax_query terms?
- Duplicate posts in paginated results
- How to order posts by title after they have already been sorted by category
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Post loop for all taxonomy terms
- Taxonomy order exception for specific term
- Custom taxonomy.php not working
- Distribute Gallery Images Every nth in Loop
- Loop parent terms {display posts} AND loop child terms {display posts}
- Trying to get property of non-object in shortocde
- Get posts from multiple tax terms
- How to Order a list of taxonomies? orderby?
- How to add custom meta to ‘pre_get_terms’?
- For each loop on every word in post
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Display name of taxonomy once
- Loop posts based on permalink term
- Check if a post has term inside loop
- Get most recent post for every term in a given taxonomy type
- More efficient way to list posts by category [duplicate]
- relation OR instead of AND – Filtered term ID’s in loop
- Show terms in archive page
- How to use this $tax_selection variable in this custom loop?
- How to get the term description in a taxonomy term archive query?
- Ascending order has strange effects on wordpress loop
- Related terms – Terms that feature in post of current term
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Can’t get term id for category archive
- 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 to make a post with certain taxonomy term display first before other post with only one query?
- Page that lists publications by classifying them by taxonomy
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Only show tag with the same id as the post
- display ACF repater field in archive page
- How to add pagination in Terms
- Prevent Duplicate Post Counted by Query
- Save queried result into database
- Filtering posts based on three taxonomies
- Display Custom Post Type Based on Taxonomy With WP_Query()
- Use ACF Category Image for all Taxonomy Archive Views
- Cloning product not copying custom taxonomies
- Get categories within specific term
- Duplicate posts on archive page
- Exclude posts from loop by term
- taxquery taxonomy get terms
- pages shortcode filtering by category
- How to show terms from another taxonomy
- dispaly all hierarchical post types from a taxonomy
- How to define a custom hierarchy for terms?
- Loop shows post 5 times in a query
- Attachment Metadata inside of Loop
- Creating a archive for taxonomy terms, not the term results
- Displaying Results From Custom Taxonomy Query
- Modify my code – which takes the first sentence of the post and use it as a h2 tag – to work outside the loop
- tax_query not working properly with get_posts
- Prevent duplicating specific column from database table
- Custom query for certain post type OR another post type with a certain category
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- how to upload image using wp_handle_upload
- Adding ‘current_post_item’ class to current post in the loop
- Adding shortcode closing tag after a loop
- Filter the loop by categories using checkbox form
- Display Post Author Link above the loop
- Trying to get all links in my posts
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Problem with my loops