I think you’re confusing old meta parameters with new meta_query
parameters. meta_key
should be just key
and meta_value
should be just value
. Refer to WP_Query in Codex for correct syntax.
Also, print_r( $country_query );
will show you the actual SQL query being sent to the database and will show you where you’re going wrong.
Related Posts:
- Can I query custom meta data through WP_Query
- How do I search an array stored in a custom-field using WP_Query?
- WP_Query – Order results by meta value
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Filter WP_Query for posts having a certain meta-value
- Meta Query with AND & OR?
- WP doesn’t show Array Custom Fields?
- Is it possible to store arrays in a custom field?
- How do I order by multiple custom fields using wp_query?
- Trying to perform complex custom field query with order by set to field value
- Query meta field using between
- Order Posts by Closest Numeric Values
- 2 orderby in wp_query with 2 custom fields
- Can serialized arrays in DB be matched against serialized arrays with meta_query?
- How to get a meta value from all post
- Compare meta_query decimals not working right
- WP_Query multiple use of relation and/or
- Query Problem – Show posts within category ‘x’ that have a custom field between ‘y’ and ‘z’
- use get_posts to get custom field data, but in one array
- Using OR in WP_Query negates the “NOT EXISTS” compare
- WP_query : meta_key with custom rule for specific value
- How can I combine meta_query queries?
- How to filter a dd/mm/yyyy date from a custom field in a query
- Using WP Query to search by multiple meta fields
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- How add a custom posttype name using ACF field to a query post array
- Compare WP Custom Field date
- Sort by posts that have a featured image?
- WP_Query display next custom post from today’s date
- Order by value in serialized custom field
- $wp_query meta_key naming issue [closed]
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- Meta_query and numeric comparison [closed]
- Adding Custom Fields to Search
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Any way to include custom fields in WP_Query results?
- Multiple relationships in a query
- Get specific custom field keys from a post and put into an array
- How do I use wp_query for WordPress search?
- Meta query with timestamp using WP_query
- Passing Custom Field Data as Array to be Saved (Resulting Custom Field Array is inconsistent)
- Conditional custom field query
- Order query by meta_value with multiple custom fields
- Auto Populate Custom Field with Complex Value That Increase by One?
- Run a check for multiple meta key values
- Create an Array of Specific Custom Post Meta
- Remove Body Classes
- How to list custom fields as headers and list all pages sharing that custom field under it?
- Sort alphabetically by custom field
- Custom WP_Query for WordPress Search Results with meta_query
- Meta Query And/Or
- How to combine custom fields to make one order-able value
- Redirect to another page using contact form 7? [closed]
- Passing meta_box string to post__in?
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- meta_value and meta_key filtering returning no posts [closed]
- Select custom posts by meta_value and sort by a different meta value
- Can’t query by meta_key
- Adding custom field and querying from post table
- change order of images attached to post
- Order a WP_Query by meta value where the value is an array
- query_posts with meta_value
- Query using string from custom field as array value
- Meta query relation ‘OR’ not working as expected
- The best way to collision check in WP
- Displaying an ACF list of users
- Meta value Array
- WP_query multiple custom fields not working
- Custom field to array?
- Show array of meta_value in Edit Post Coloum
- Custom Query Fields – Altering Meta Value
- How to Convert Custom Fields from Text to Array?
- How to query for posts with either one or another custom field
- Multiple Custom Field Query
- Custom field outside the loop and inside an array
- Get custom post fields from multiple metaboxes
- How to update custom field of a posts in a particular category
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- Working with multiple values and metaboxes
- Custom Field: how to save array of multiple key-values in WordPress
- Retrieve all custom field values of a specific custom field metakey as an array, inside WP_Query
- Trouble with serialized metadata
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- How to save array option as text and not integer?
- Should I store arrays in custom fields or create custom tables?
- How do I use foreach to get content from a custom-field in multiple posts?
- WP Query multiple select form – meta_query help
- How to Order Posts by Custom Fields?
- WP_Query based on multiple metadata comparisons
- Complex WP_Query Using Post Date And Post Meta
- Display posts where date field matches current month?
- Show posts containing or not custom field
- Display agents (custom post type) alphabetically, except one who always shows last
- Adding custom field to an array
- How do i output images from URL’s added to the same custom field key
- Extract array from custom field
- Build Array from Input Fields question
- Query posts by Custom Meta (checkbox) & Genesis Grid Loop
- Custom fields: Split data from single custom field’s sub-array to separate custom fields when saving post
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?