WP Query not working with ‘post__in’ AND ‘meta_query’

[ad_1]

Hi, I have a query where I’m trying to get posts with a meta query as well as specific posts. When I use the ‘post__in’ and ‘meta_query’ parameters independently, they work fine and I have 3&9 posts respectively as it should be. When I combine them, I should get 12 posts but the result is 0 and I can’t seem to figure it out. I’ve tried different relations in the meta_query but this doesn’t change the result. Am I missing something please?

[ad_2]
1 Comment
  1. When you use both, query will get only posts that belong to post__in AND match thr meta_query. Putting OR in meta_query is only relavant to meta_query when you have more than one meta_query element.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer