I managed to resolve by extending the query
function extend_search( $search, &$wp_query ) {
global $wpdb;
if ( empty( $search ))
return $search;
$terms = $wp_query->query_vars[ 's' ];
$exploded = explode( ' ', $terms );
if( $exploded === FALSE || count( $exploded ) == 0 )
$exploded = array( 0 => $terms );
$search="";
foreach( $exploded as $tag ) {
$search .= " AND (
($wpdb->posts.post_title LIKE '%$tag%')
OR ($wpdb->posts.post_excerpt LIKE '%$tag%')
OR EXISTS
(
SELECT * FROM $wpdb->postmeta
WHERE post_ID = pl_posts.ID
AND meta_key = '--KEY--'
AND meta_value LIKE '%$tag%'
)
)";
}
return $search;
}
Related Posts:
- How to redirect to post if search results only returns one post
- Possible to search by author name with default WordPress search function?
- paginate_links() don’t properly work in search.php?
- Filter the query ONLY for the search results page
- Modify search function in WordPress (TwentyTwelve)
- How to customize search result page title?
- Display WordPress Search
- Search user metadata with checkboxes via ajax (almost working)
- Searching for content post
- changing behaviour of get_search_form
- Search filter by Post title OR Meta Title Value [duplicate]
- Using wp_redirect and .htaccess to re-route searches (and pass along the remaining GET vars)
- paginate_links() don’t properly work in search.php?
- Include the post type before the title of search results
- How to rewrite wordpress search to work on specific category
- two search forms on the same page
- search form leads to 404
- Custom function for search form
- WordPress: Highlight search result exact matches
- Limiting WordPress Search function : Custom build
- More than one search results page template for two searches on site
- How do i create a search option for pdf’s only
- Form output outside of container
- Limit Number of Posts on Blog Category Page Throwing 404 Error on Paginated Pages
- us states dropdown function and echo in theme template files
- Pagination in Search result
- Make WordPress search for only this tags or exclude certain tags from search [duplicate]
- child_of not working while searching
- Search Woocommerce product titles only
- Custom Post Type Search
- What’s the difference between WordPress random_int() and PHP built-in function random_int()?
- Is it ok to use a function to output the text domain name in a wordpress theme
- How to use the do_action () with parameter
- Issue with wp_get_attachment_image() and SVG file type
- How to override a function when isn’t at functions.php
- TinyMCE custom styles remove class when switching styles
- deregister scripts on certain page
- contactform7 remove tags with “wpcf7_autop false” from functions.php
- How to count number of functions attached to an action hook?
- Show modified time if post is actually modified
- wp_is_mobile function
- Get user id from email?
- Custom menus displaying all pages instead of set pages
- Show Video in Excerpt
- How Can I Access a PHP Variable in Another PHP Function
- How to fix a theme with page.php Default Template that accidentally deleted?
- Override parent theme function that is not hooked or in the functions.php file
- Theme Demo in live Site
- function to include is_home, is_archive, is_category, is_author etc in one function?
- How to remove canonical url in wordpress? add_filter( ‘wpseo_canonical’, ‘__return_false’ ); not Working for me
- Child theme – copied some files from parent to child website still uses parent files
- Problem with extract() with custom shortcode
- Change a sidebar name?
- Removing title from page
- get_the_excerpt() not returning anything when post has no excerpt
- Using locate-template & shortcodes doesn’t appear to work
- Widgets Section not displaying in theme customizer
- add sidebar area to header of child theme
- CSS stylesheet not loading
- Why isn’t is_page_template() adding a body class?
- Query children and parent title
- How to make unique add_filter to the_content of specific page template files – so each template gets its own addition
- Hide the Private prefix on one specific page
- Generate permalinks
- Creating loop within functions.php
- Limit filter upgrader_post_install to a single plugin
- How to test for Super Admin
- Best Practice for Syncing Local Development With Staging Development [closed]
- How to use max and min values of custom fields
- creating shortcode to pull json array
- Still relevant method of embedding images in WP Theme in 2018
- Pass Shortcode Attribute to footer Script
- How can I create a page with a specific URL?
- When using wp_enqueue_script(); in a theme why don’t we use add_action?
- How does this function get the id of the most recent post?
- Batch update menu_order attribute alphabetically
- How to create function from code?
- How to use Internationalized human_time_diff() function in Chinese?
- post to subcategory and parent in wp_insert_post
- Replace menu links with # and add name to its li
- Ajax not working properly
- I did group my search results by post type, but how can i give each of them its own order?
- create shortcode to list users with specific meta key value
- Variable if post is sticky in functions.php
- Retrieve tags data in post body
- How to add ‘data-caption’ inside an anchor tag
- Change template on the fly based on post parent selection
- Current path on page in functions.php
- How do you publish a draft on WordPress
- How can I recompile js file in dist folder?
- Execute a ultimate member action when user role is updated
- Create a new query in function.php to filter blog posts
- Why is functions.php file in child not initializing and over-writing parent?
- Use third party Library in wordpress
- Remove the product category module block from the Woocommerce product page
- Setting youtube size in functions.php
- Creating new blog on multisite programatically without hacks?
- Allowing users to view private posts (pending approval)
- How to get correct URLs in network wide menu (Multisite)?
- wp_get_archives custom function broken since upgrading to WP 3.7.1