I'm trying to query 'live' posts for 'venue' field existing (venue field is ID's of venue pages). Query those venue IDs/posts for which ones have a field 'country' that's value (ID) matches a specific country value.
$shows = get_posts(array(
'post_type' => 'live',
'meta_query' => array(
array(
'meta_key' => 'venue',
'meta_query' => array(
array(
'meta_key' => 'country',
'value' => 'country_1',
)
)
)
)
));
WP_Query isn't designed to make such query-in-query logic. It should have one single post_type, one single meta_query.
That's why you need to use 2 queries instead.
In the given code you need to change meta key and values of course.
Update:
If your input parameter is array of venue IDs and your output is supposed to be country posts of those venues, then you can use these queries below: