I wasted some hours on that…. to know how can i get multiple meta_query like :
from a simple array like :
'meta_query' => array( 'relation' => 'OR', array( 'key' => 'mykey', 'value' => 'value1', 'compare' => '=' ), array( 'key' => 'mykey', 'value' => 'value2', 'compare' => '=' ), )
$mykey = array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 );
I need to generate the meta_query automatically because the array is not always the same. Thank you by advance! Julian
No body knows….
Please wp coders… help me !
Are you trying to display all posts that have value under certain meta key, and that value should be one of the values in the array you provide?
'meta_query' => array( array( 'key' => 'mykey', 'value' => $mykey, 'compare' => 'IN', ) )