From the developer docs:
relation
(string) – The logical relationship between each inner
meta_query array when there is more than one. Possible values are
‘AND’, ‘OR’. Do not use with a single inner meta_query array.
(Emphasis mine).
It’s a bit hacky, but you could run a separate query against the meta field, then merge the results into the default search query before The Loop thus:
$wp_query->posts = array_unique ( array_merge( $wp_query->posts, $meta_query->posts ) SORT_REGULAR );
$num = count( $wp_query->posts );
// these two should be the same in this case because posts_per_page is -1
$wp_query->post_count = $num;
$wp_query->found_posts = $num;
Related Posts:
- wp_query check if integer exists in custom field’s array
- WP_Query orderby custom field then post_date in one query
- Filtering a WP_Query meta_query by numeric values isn’t working
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- How loop through posts based on custom fields
- Filtering by Post Meta Custom Fields – Performance
- wp_query to find posts by year and month
- 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?
- First custom field value (out of several) displayed twice after query
- Possible to filter custom post type with multiple meta data?
- Query based on custom fields start and end date
- WP_query – Filter by tax_query and meta_query using multiple select
- Getting a custom post’s custom field based on another custom post’s custom field select
- 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
- Storing/querying custom date data
- Querying meta values within an array
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- WP Query Conditionally query meta and taxonomy
- How to Add Custom Fields to a Custom Post Type?
- Mixing regular and custom post types (with meta_query) on home page
- $wp_query->queried_object->ID throws warning: Undefined property
- how to filter by last name for custom post
- clients list using wordpress
- Custom Taxonomy Template Post List with Sort Order
- The Operator “NOT IN” Does Not Work In tax_query
- Display Custom Post Type Fields
- How to do a custom bookmarks post type?
- How to get_queried_object on multiple objects?
- How to get the parent’s taxonomy?
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- WordPress query by multiple Custom fields and order by date
- Help with hierarchical custom taxonomies and permalinks…almost there
- WP Query group/order by category name
- query order by date on custom type: wrong order
- exclude custom post type by meta key in wp_query
- Optimised Code for Pulling Taxonomy Posts
- Automatically populate a hierarchical taxonomy from a custom field
- Fetch taxonomies by custom post type id array
- Custom Post type and Custom Field WP_Query
- shortcode to show custom post types by category
- WordPress custom loop filter by meta_key and value with serialize data
- Query/list all terms and their custom post count
- Genesis filterable portfolio isotope [closed]
- Get custom taxonomies from multiple posts
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Meta Query Not Returning Output Despite Having Matching Values
- Why is this query not working? (Standard posts + custom post type)
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- filter search custom field query
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- WP_Query() with custom post type and taxonomy — get all terms?
- Variable not working in WP_Query
- Wp Query with multiple custom tag(taxonomy) by get the terms
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- tax_query (if the terms are empty)
- How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]
- Custom post type name and assigning custom taxonomy
- Group by custom field value (start and end times)
- Building a Portfolio and need some direction
- Get posts by category name
- WP_Meta_Query object with conditionals
- Query custom posts from custom taxonomy
- Query Custom Post Type by Taxonomy
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- Related “custom post type” using “custom taxonomy”
- How to order query results based on if a custom field has been populated, then the order by the date of the post?
- Using OR relation in meta_query to check for a value before sorting by another
- WP_Query get always custom post_type for first
- wp_insert_post deleting previous post custom meta
- Show posts from WP Custom Post Type selected from a field in a metabox
- WP_Query based on ‘s’ and tax_queries
- post type => ‘any’ not applied my custom queries
- Custom taxonomy template for custom fields loop [closed]
- WP Query tax_query not returning posts
- The most recent post of custom taxonomy
- What’s the most efficient way to get two queries based on an if statement?
- Problems with the WP_Query query for a Custom post type
- Query pulling all taxonomies, not one I am specifying
- Get archive of posts separated by taxonomies and subtaxonomies
- predefined custom field on registration page
- Post data in separate divs with incrementing class using WP_Query
- WP Query WordPress Post Type with the same Taxonomy name
- How to list groupings and keep pagination
- How to retrieve taxonomy terms of the current custom post?
- Query recent posts by author
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- display custom post type from register taxonomy
- How to change order of custom post types. I want Featured post to come first
- Function to Compare CPT Post Custom Value with Default Posts CF Value
- Sort CPT by taxonomy AND THEN by custom field
- Complex Custom Loop with Includes