Answering my own question, as suggested in my edit I’ve had to use the following meta_query
array to query the posts:
'meta_query' => array(
array(
'key' => 'country',
'compare' => 'LIKE',
'value' => '"' . get_the_ID() . '"'
)
)
Related Posts:
- WP_Query orderby custom field then post_date in one query
- Filtering a WP_Query meta_query by numeric values isn’t working
- How Can I save multiple records in same meta key?
- Can’t sort order of wp_query with 2 meta keys
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Filtering by Post Meta Custom Fields – Performance
- WP_Query: include custom post type only with specific meta value
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- wp_query check if integer exists in custom field’s array
- Possible to filter custom post type with multiple meta data?
- Query based on custom fields start and end date
- How to get specific post meta by title or id
- Getting a custom post’s custom field based on another custom post’s custom field select
- WP_Query of custom post type sorted by meta_key has unexpected results
- WP_Meta_Query object with conditionals
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Use WP_query to match post types based on custom field values
- Show posts from WP Custom Post Type selected from a field in a metabox
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Custom post types – meta_query: search lesson which starts sooner
- Meta_Query refuses to return results
- Query events post type after current date and timezone
- Selecting posts older than the current Unix epoch timestamp
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Check for custom field value in different post type than current one and do something
- WP_Query not using relation key as expected and not producing any results
- Setting proper query for multiple custom admin filters
- WP_Query orderby modified to include custom meta changes
- WordPress custom loop filter by meta_key and value with serialize data
- Display custom post type from dynamic custom field
- How to make Meta Query case sensitive?
- Meta Key Value in current-user-only loop
- How to check if user meta field is empty in conditional else statement
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- Get posts between custom dates
- How to implement a Google map store locator
- How can I get the number of custom post type posts that have a specific attachment image set?
- Posting to a Custom Post Type from front end – user generated content
- Fetch Record based on meta key dates
- Update Post Meta for a logged in user
- Problem querying Custom post type by custom fields
- Orderby CPT custom fields not working
- WP_Query order by custom field, then randomly order some of results
- A better way to add a meta box to custom post types
- Two Custom Post Types Many to Many Relationship
- get_post_meta not working on publishing
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Query custom post type with ACF Date
- How to do WP_Query with two meta fields with orderby clause
- Stuck in Order by more then one
- Meta Query Not Returning Output Despite Having Matching Values
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- Including metaboxes from custom post types in global search — continued
- How do I set all of a particular post meta to a value within the custom post type I’m in?
- Query Multiple Custom Posts by Custom Fields
- how to make members list directory through wordpress post custom meta key.
- Why is this query not working? (Standard posts + custom post type)
- Get Posts by multiple custom fields is not working
- WordPress request fiter order by related post’s post_title
- Order Custom Post Type by Custom Field Value
- Large AND OR query timing out
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- First custom field value (out of several) displayed twice after query
- Meta Query posts not showing on ending date of custom field
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- Configuring a meta query with multiple post types that have the same relationship on a single page
- How to Output which matched meta_keys were found from custom_type_posts?
- Importing Data from a Non-WordPress database, into WP
- filter search custom field query
- How to let users choose where to search for posts?
- Custom fields for custom post type
- Check if post with same meta value exists
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- Is it possible to retrieve all posts with a certain value for metadata?
- WP Query ‘posts_per_page’
- Submitting Custom Post Types with custom fields from Front-end form
- create custom meta box with default value
- Display post from a date range from custom field
- Displaying a div from an assigned meta_value when on a page
- post_per_page ignored in WP_Query
- WP_query – Filter by tax_query and meta_query using multiple select
- delete_post_meta() for whole CPT / multiple posts?
- WP_Query orderby not work with meta_key
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- find custom post type post by searching its custom field with my string
- $post->post_meta not pulling any post in wordpress/php
- Returning a custom content types with meta values
- copy images from custom field to another custom field
- Custom Query: If One Post Object Field Value Is The Same As Another
- Display custom post type for specific user
- How to show custom field on specific custom post type posts only when filled
- Custom Post type loop with ACF not displaying properly
- Create a WP_Query where if the first value of the first row is equal to the second compare other value
- Cannot obtain custom meta information
- Group by custom field value (start and end times)
- How can I output WPAlchemy repeating fields meta values in my page template?