Hello!
I have the following wp_query
$posts = get_posts(array(
'post_type' => 'product',
'post_status' => array('publish', 'draft'),
'orderby' => 'publish_date',
'order' => 'DESC',
'posts_per_page'=> 20,
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'category',
'value' => 'cat_a',
'compare' => 'LIKE'
),
array(
'key' => 'category',
'value' => 'cat_b',
'compare' => 'LIKE'
),
array(
'key' => 'category',
'value' => 'cat_c',
'compare' => 'LIKE'
),
)
));
Is there any way how to write the meta_values as an array rather than listing all the meta_query values possibilities?
What I want is a query that displays every post that has the category “cat_a” OR “cat_b” OR “cat_c”. Something like:
array(
'key' => 'category',
'value' => array('cat_a','cat_b','cat_c'),
'compare' => 'LIKE'
),