Skip to main content

I have 2 instances of the wp_queryWP_Query class, one showing 4 "Featured" posts and another showing "basic" posts.

What I want to do is exclude those 4 latest "Featured" posts from the basic query. I assume it's just a case of adding a post__not_in variable but how can I get the ID's from the first query and exclude them from the second?

I have 2 instances of wp_query, one showing 4 "Featured" posts and another showing "basic" posts.

What I want to do is exclude those 4 latest "Featured" posts from the basic query. I assume it's just a case of adding a post__not_in variable but how can I get the ID's from the first query and exclude them from the second?

I have 2 instances of the WP_Query class, one showing 4 "Featured" posts and another showing "basic" posts.

What I want to do is exclude those 4 latest "Featured" posts from the basic query. I assume it's just a case of adding a post__not_in variable but how can I get the ID's from the first query and exclude them from the second?

Source Link
Poisontonomes
  • 606
  • 4
  • 17
  • 28

Get post ID's from one query and exclude from another

I have 2 instances of wp_query, one showing 4 "Featured" posts and another showing "basic" posts.

What I want to do is exclude those 4 latest "Featured" posts from the basic query. I assume it's just a case of adding a post__not_in variable but how can I get the ID's from the first query and exclude them from the second?