Split the search query by white space and change ‘compare’ to ‘IN’ to be able to use meta values array:
<?php
$s = get_search_query();
$s_array = explode( ' ', $s ); // search query array
$args = array(
'post_type' = > 'product',
'meta_query' = > array(
'relation' => 'OR',
array(
'key' => 'vbs_author',
'value' => $s_array,
'compare' => 'IN', // note the change
),
array(
'key' => 'vbs_publisher',
'value' => $s_array,
'compare' => 'IN', // note the change
),
)
);
Maybe you’ll need to remove duplicates after this.
Related Posts:
- Creating search form for custom database table
- Search through custom post type and custom fields takes 5 minutes
- Customise search form in the Widget
- Comment filtering (search)
- Custom search page and search by title, content and tag
- Search a post using the date it was posted
- Setting custom search engine indexing for a “dynamic WordPress page” with htaccess
- Custom URL going to 404
- Search result page redirect ex.com/?s=searchterms to ex.com/searchterms
- Hi, I wanted to make custom search with multiple fields
- Steps for custom data retrieval
- Custom search to display results within same page
- Search widget will search everything in the site, how to limit to only search gallery name
- How to hook up search results page to a back-end page?
- Admin search post meta
- Add a searchbox to the body of a page
- Custom Search on Custom Page while preserving the main search function
- Custom Loop Query For Search Page
- Search URL parameters query [duplicate]
- Applying WP-cli Search & Replace to Static SQL Dump File
- How to create custom search page
- Custom Same Page Search
- How to Add Additional Search Button?
- How to Clear Empty Search values?
- WP Search Form Query: Add Author’s posts into search query
- WordPress search on a custom table
- Adding overlay search to wordpress using add action/filter
- Allow WP users to sort search result on a videos site
- WP_User_Query Search Multiple Keywords from a Multi-Select Field?
- Custom dropdown search form that allows users to select option B based from Option 1
- Custom search results
- WordPress custom search – pagination
- Creating a search with tag variable also added for more detailed results
- What shortcode should I use for
- Two searchforms with different categories/posts per page
- Search a meta field for a value in all posts
- Custom search by several options send on form not works
- Search results load individual post in slide out div
- Custom Search Results Page
- WordPress Search on Multiple wp sites
- Create a custom search for Estate Agency WordPress site
- How can I make a search term redirect to a page
- Sort Search Results in Order of/by Character @ count (9) of post(s) title. (Ocean-WP theme)
- Show total sales for each products on search results page Woocommerce
- Custom Search on media files PDF images pages posts
- Custom maintenance page
- How to customize the default HTML for WordPress Attachments
- Is it possible to change the attributes of a registered style or script before it fires?
- how to change “published date” format on edit.php (Posts page)?
- How can I integrate pages written in something other than PHP?
- How to change submit button value in comment from “Post Comment” to “Send”
- How to hide WordPress files / structure? [closed]
- Customizer: How do you add HTML to control labels?
- Customizing the default logout page of WordPress
- multiple comment text areas
- Remove Author Slug & Replace With Username
- How can I control an external php (with external database) page with WordPress?
- show the meta values to visitors that collected via coment form
- Defined Blogname Override?
- Not sure how I would go about doing this in WP.. related to custom tags
- TinyMCE custom dialog with selectbox not working
- Publishing html directly from ftp to wordpress
- Load more posts with multiple queries
- Get Date of custom field and use conditional logic
- How to wrap the list with custom class using wp_nav_menu?
- change url for static files in /wp-admin with a cdn url
- Sub menu indicator that links to sub menu
- How can I have a common background color across multiple WordPress blocks?
- What requirements for ACF custom fields key and name properties?
- Get Custom Taxonomy Terms by Date
- Removing blank space below header [closed]
- Point homepage to custom php page
- If the image variable is specified, show image, if not no code
- Replacing words in WordPress or theme (not in content)
- How can I tag a menu item as visited for each unique user?
- Many Rewrite Parameters/Rules
- Adding other links on header than LinkedIn, Facebook, Youtube etc
- How to Render Post Types in RSS Feed?
- Custom Taxonomy Sort For a Custom Query
- Display a specified content on a Page and all its child pages
- kitchen sink not working
- Is it possible to auto sharing post on social network from specifc categories or tags
- wp_insert_post custom taxonomy multiple Category not added
- WordPress category custom title
- Can’t upload format files on media library
- How to display strikethrough text in button text (for special offer)
- Remove Title and White Space in Twenty Twenty theme
- Redirecting wordpress search query to archive page
- How to have differents sites share the same tables of DB?
- How to add particular attribute of product in shop as well as home page
- How to change custom link of subpages from of localhost to website
- Duplicate Header and Footer
- Send email notification when post type product is publish from pending status
- Custom login doesn’t stay
- Smarter Document Management links between three WordPress sites sought
- data retrieval presents last set of data
- Accountless password generation
- Create a google friendly header with text and logo
- Disallow “contributors” to edit their own posts once they’ve been set to “Pending Review”
- Post interior margin in twenty eleven theme