wp_query and IN operator
-
Can someone provide an example of using the IN operator with meta_query?
I am trying to find posts which have one of 3 possible terms stored in a meta field. So, I want to find all posts that have term1,term2 or term3 stored in a specific meta field.
I’ve tried
'meta_query' => array( array( 'key' => 'meta_field_name', 'compare' => "IN('term1','term2','term3')" ) ),
But I end up with posts that have terms other than these 3, like ‘term4’, in the meta field.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘wp_query and IN operator’ is closed to new replies.