I have built a complex query which should do 3 things:
- select posts with ids in the $additional_ids array using post__in;
- ignore posts with ids in the $ignore_ids array using post__not_in;
- select posts with a combination of cpt values (ie. is an animal, is blue and eats grass) using meta_query.
Here's what I have so far:
$args_assets = array( 'post_type' => 'assets', 'posts_per_page' => -1, 'post__in' => $additional_ids, 'post__not_in' => $ignore_ids, 'meta_query' => array( 'relation' => 'AND', $query_animal, $query_color, $query_food, ), 'orderby' => 'title', 'order' => 'asc', );
The query works fine WTHOUT the 'post__in' => $additional_ids line. As soon as I add the post__in argument, the query returns an empty result.
Is it possible to combine post__in with a meta_query? If so, what's the best method?
Thanks in advance for any help!