I have a custom WP query that searches a single custom field, using an array.
The custom field is for the country of origin of a post. The array I'm using are the names of the various countries in a region. The objective is to be able to return all posts from a region or continent.
Here is my query:
$args = array( 'posts_per_page' => '-1', 'cat' => '4', 'meta_query' => array( array( 'meta_key' => 'Country', 'meta_value' => $country_search, 'compare' => 'IN' ) ) ); $country_query = new WP_Query( $args );
$country_search variable is an imploded array: 'Albania','Andorra','Armenia','Austria','Belarus','Belgium', etc.
What happens is that no matter which region I search for, while the correct country array is returned, the query returns all of the posts in the database.
I'm sure it's something simple, but my head is sore from banging it against the keyboard.
I greatly appreciate any help.