Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created February 14, 2019 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/ad2b6d128ad3c91bdfcd964cfdc4a659 to your computer and use it in GitHub Desktop.
Save jchristopher/ad2b6d128ad3c91bdfcd964cfdc4a659 to your computer and use it in GitHub Desktop.
Using this hook you can tell SearchWP to find partial matches even if there are exact matches in the search query
<?php
function searchwp_partial_matches_lenient( $return, $args ) {
// $args contains information about this request
// - engine
// TODO: customize $return to match whether matching should be lenient
return $return;
}
add_filter( 'searchwp_partial_matches_lenient', 'my_searchwp_partial_matches_lenient', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment