Note: You are viewing the documentation for Version 3View Version 4 Docs


View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

Available since: 3.1


View Parameters »

When Automatic “Did you mean” (search query corrections) or Quoted (Phrase, Sentence) Search Support has been enabled either on the Advanced tab of the SearchWP settings screen or using a hook (searchwp_do_suggestions and searchwp_allow_quoted_phrase_search, respectively) SearchWP will automatically output a notice at the top of The Loop indicating that a search query has been revised.

This happens only when search query corrections have been enabled, but you can prevent that from happening by adding this to your theme’s functions.php:

// Prevent SearchWP from outputting notice about search query corrections.
add_filter( 'searchwp_auto_output_revised_search_query', function( $enabled, $args ) {
// $args contains the search query arguments for the search
// $args['type'] will be 'did-you-mean' for "Did you mean?" corrections
return false;
}, 10, 2 );
view raw functions.php hosted with ❤ by GitHub

With this snippet in place, automatic output of SearchWP’s notice will no longer take place, and you can use the searchwp_revised_search_query action to output your own notice:

// Output a custom notice when SearchWP finds a search correction.
add_action( 'searchwp_revised_search_query', function( $args ) {
// TODO: Output a notice indicating a search correction has been made.
view raw functions.php hosted with ❤ by GitHub

Note: The $args passed along with the hook will contain a type key that indicates whether a “Did you mean?” or quoted search fallback has taken place.


Parameter Type Description
$enabled Boolean

Whether automatic output happens

$args Array

Search query arguments

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP