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
- WP Query filtering by custom category not showing all relevant posts
- Custom post type and custom taxonomy 404 on page 2
- tax_query (if the terms are empty)
- Display custom post type for specific user
- Custom Post type loop with ACF not displaying properly
- How to fetch custom post types with its full data on wordpress?
- Reusable metabox backend and frontend
- How to populate a Gravity Forms Custom Post Field (dropdown type) with custom taxonomy terms? [closed]
- How to count other posts not having specific taxonomy terms?
- Create a WP_Query where if the first value of the first row is equal to the second compare other value
- Exclude latest post from WP_Query taxonomy term loop
- Get custom term meta problem on single post type
- Custom post type name and assigning custom taxonomy
- Group by custom field value (start and end times)
- How to query Posts from a custom post type which contains a custom taxonomy?
- Query Posts that have Custom Taxonomy
- List all Custom Post Type posts excluding certain Taxnomy term
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- Building a Portfolio and need some direction
- Get posts by category name
- Query Posts, order by meta value
- WP_Meta_Query object with conditionals
- Custom post types category
- Sorting by meta_key different to search criteria?
- Using WP meta query to show custom post types by a start and finish date
- Two queries – one with checkbox ticked, one without – comparing meta_query
- Foreach loop returning more than one item when querying taxonomy
- Custom Taxonomy dont save in a frontend form for post a custom post
- WP_Query order custom post type with certain meta key value by post modified date
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Cache issue with WP_Query and custom field filtering
- Query custom posts from custom taxonomy
- How to display posttypes and taxonomy in standard posts, not in a separate label?
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Making a form for user to add new custom post with custom taxonomies and custom fields
- Should i use custom post type for a custom footer?
- Query Custom Post Type by Taxonomy
- Order custom posts by taxonomy, then by meta_key
- Display featured posts for a custom post type by taxonomy
- Confusion about how to use Custom Post Types, Custom Taxonomy or Category?
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- How do I list a custom field and custom taxonomies for each result in a loop?
- Writing a custom Glossary plugin
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Related “custom post type” using “custom taxonomy”
- What is the most efficient way to execute recursive complex queries?
- Sorting the Loop by Taxonomy Value
- How do I ensure that post_type and Taxonomy use the same slug?
- add_filter get array data before display in custom post_type
- WP query_posts group by meta field related
- How to order query results based on if a custom field has been populated, then the order by the date of the post?
- order the meta query results by 2 custom fields
- Custom taxonomy terms as children of multiple custom post types
- ACF – Retrieve custom taxonomy from a relationship field
- custom taxonomy pagination 404 error
- Ordering by meta value not working
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Custom Form / Search with Custom Post Type Data
- set object terms after some some time of published post – functions.php
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- Create if else for post types in WP_Query ‘post__in’ values
- WP Query from two Custom Post type fields as statement
- Alike Shortcode using in Custom Shortcode
- Sort custom posts by date and then by taxonomy
- Query custom post type that has a serialized relational advanced custom field value
- have to do a while have post to show for two custom post types sharing the same taxonomy?
- Dynamic template page calling shared taxonomies CPT or Plugin post type : how to clone taxonomy for plugin + set up dynamic shortcode
- Using OR relation in meta_query to check for a value before sorting by another
- custom post type and a “sticky” position taxonomy
- WP Admin Dropdown List Filter for custom (ACF) field on custom post type(s)
- Display post count for a specific month
- display post count in archive page that have relation with another taxonomy term
- WP_Query get always custom post_type for first