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
- How to influence the information displayed on widget inside wp-admin
- How can I get $id variable in widget’s form function?
- Add attribute to link tag that’s generated through wp_register_style?
- Default or Preset Content for Custom Post Types
- Problem using is_single() to enqueue script from functions.php
- If function exists, and array is met, echo function?
- RSS Feed has no styles in chrome – function to add one?
- change default option in wp_dropdown_categories
- How to change menu icon which is overriden (i.e. by WooCommerce) [closed]
- Change the slug of a particular page every x hours
- Use of undefined constant bloginfo
- Change size and crop medium_large images
- Ninja form Redirect depending on text field content [closed]
- Display Password Protected external RSS in wordpress template
- Problem only while using require_once() within functions.php
- Remove elementor header and display default theme header
- How to force field validation first, then its values saved durning edit profile?
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- enqueue styles for only mobile wp
- WordPress PHP Conflicting User Sessions
- Registration Hooks don’t appear to be working
- Allow Contributor to edit their own posts after Adm aproval
- help I changed one currency in woocommerce and everything is ruined [closed]
- How to run a function in every page, every device
- Change slug shortlink “/?p=” base in WordPress
- How to ignore posts in pre_get_posts?
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- New functions in separate directory — better, portable way
- WordPress Migration error phpupdate_option is not a function
- Proper Way to Load stylesheet on Condition
- How do I place a function in a standalone page?
- Problem in using Customizer
- Ajax resetting my global variable
- Problem enqueuing scripts on not single posts
- Do I Need to Prefix Variables Inside Functions?
- is_main_query() always returning false
- Render page with specific id from functions.php
- Display Child Pages if no child Exists Display Siblings
- How to show ACF value under post/page title in wp-admin
- Filter works on last selection but no others
- Undefined variable issue for wp_get_attachment_image_url
- ACF Flexible in TCPDF
- How do i tweak my wp Post title base on category of the post
- Why isn’t comment validation working?
- I’m creating a online store for my website, my aim is to add description to products in home page only how can i achieve it?
- modifying every other element’s class inside while loop
- Adding Custom Body Class for Page: Shop
- Menu and category highlighting for a single post
- “Conditional query tags do not work before the query is run. Before > then, they always return false. “
- Change ‘Categories’ to ‘Topics’
- True email confirmation for registration (keeping unvalidated users from user table)
- Code I am placing in the wp_footer is going outside the entire HTML frame!
- wordpress function through ajax not being called
- How to assign results to variables?
- Restoring pages in wordpress
- Different body image backgrounds on different pages, posts and categories
- Hide certain post types from editors
- Language switcher for subdomains
- Function to draw random image from specified category destroys site logic – why?
- How to mirror exactly the left admin menu on front end?
- Add Function For Instances of Custom Text in Multiple Category IDs to display in post content
- Move captions under gallery images in twenty fourteen theme
- How to add a class name to the ancestor of a post?
- Make a table out of meta box
- is_user_logged_in() isn’t working
- Retrive post by tags PHP code
- Add custom css to theme
- Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?
- Get all users from role and add to dropdown (select) – wordpress, javascript
- WordPress enque the same script causes the setInterval not to work