The meta_query
parameter must be an array of array if you want to add relation between different key, even they only one key to grab.
So $query->set( ‘meta_query’, $meta_query );
Must be
$query->set( 'meta_query', array($meta_query) );
You can have a look to WP_Query for more details.
Hope it helps and work, I just look for this details 😉
Related Posts:
- Using meta query (‘meta_query’) with a search query (‘s’)
- Including custom fields in search?
- Add custom fields to search
- Custom search: by post data and post metadata?
- Need small coding with Custom Fields Search
- Search ONLY by meta key / meta values
- Filter results with custom field values and dropdown
- Add custom field (value) to search result (without plugin)
- Is there a way to do multiple ordering on a multiple meta_query?
- searching in custom meta field
- WordPress Search Custom Meta Field Only
- Exclude custom post type from search by custom field value?
- Extend ‘The Events Calendar’ search to include custom fields [closed]
- Include woocommerce custom field value in front-end search result
- Including Database Generated Pages in Site Search [closed]
- Adding Custom Fields to Search
- sort search results by custom fields using dropdown
- Using a checklist to search against metadata
- How do I use wp_query for WordPress search?
- Custom Fields Not in Search Results
- How make a custom search on backend in WordPress without plugin?
- filtering custom post types via meta data drop down
- Advanced search by two criteria – sort by location and date (ascending or descending)
- How do I have WP_Query match posts based on search parameter OR meta fields? (rather than search parameters AND meta fields)?
- Merge Multiple Custom Fields into one New Custom Field for Searching
- How to populate custom field dropdown box based on prior selection?
- Search in Archive Pages by subcategory, tag, custom field and year
- Custom WP_Query for WordPress Search Results with meta_query
- filter custom field values $min $max
- Restrict WordPress Search to Custom Field
- How can you include custom post meta in search without calling each key?
- Include one custom field in search results
- Custom search SQL Query to add custom field in result
- Search Results Page – Displaying Custom Meta Fields
- Custom field Search with Relavanssi
- How to exclude custom fields from search queries?
- How to show content of custom fields in search results?
- Searching with Multiple (Parallel) Criteria on Custom Fields?
- Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches
- Type character in name and make it invisble
- Search & column order by meta value in admin
- search based on custom field
- Very large list of options for BuddyPress profile fields
- searching by keywords in post’s metas or pagination links problem
- Search fails when using the radio buttons
- Admin – Search Events by a custom field
- Search one custom field?
- Create custom query for search?
- Query postmeta values, and return multiple post_titles for common meta value
- Query Custom Fields in Searchform
- Help sorting by Meta Key value
- Custom search with meta fields
- How to display search query as formatted text?
- Search for meta_query does not return any result if combined with title
- Custom post meta field effect on the performance on the post
- Having different sidebar content for MANY pages?
- Plugins won’t recognize my plugin’s hidden custom fields
- If value present, order posts by two consecutive custom fields
- Save page data to an xml file
- Create Posts using Import>RSS/WXR/XML and pass values to Custom Fields
- How to save a ToggleControl value in a meta field?
- How do I get the url slug inside the dashboard for a custom post type?
- How do I use Ajax to build a dropdown of custom fields based on a post selected in previous dropdown?
- Register rest field for specific user
- Custom Field Suite A little problem
- Save the_content into custom field
- how to upload a image from frontend with wp_insert_post and also update_post_meta?
- Passing args to WP_User_Query am I using meta correctly?
- How to get latest post value if first post is empty in wordpress
- Searching Custom Fields
- Custom fields attached to a page template only show on edit screen when page is saved
- Value from custom field is not being displayed?
- Can I access a post meta field before the loop?
- wrap text around custom fields array
- Displaying page image in the footer automatically
- Show image if author meta (profile fields) exists outside loop
- How can i retrive a text from a custom field
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- Buik update custom field values from external API
- Filtering custom posts by custom fields (ACF) [closed]
- Change a custom field value after X number of seconds
- Jquery on custom-field backend
- Custom fields won’t update
- How to use custom fields like Title to show value in content?
- Populate custom checkout fields with data from previous orders
- Expire Date Condition not Working ACF WordPress
- Making custom meta box required (with error message if not filled in) on Gutenberg
- Changing form action based on selected value
- What is the correct way to search 3 custom fields only in WordPress?
- How to add content with a filter when there’s no content in the editor
- Text in header as a page – hide from Web crawlers
- When post is updated, custom metadata in text area field is overwritten
- Custom Fields – How can I remove the publish option for certain users
- Can i categorise my meta box?
- How to overwrite a value for a custom field?
- WordPress archives by custom field and date
- Function to retrieve a picture if there is no picture is attached
- Show posts containing or not custom field
- add_post_meta insert null value into Database
- extra post fields for url + youtube video / implementation