Available since: 3.1
searchwp_do_suggestions
View Parameters »SearchWP has the ability to support “Did you mean?” style search suggestions for queries that yielded no results. This feature can be enabled by ticking the checkbox on the Advanced tab of the SearchWP settings screen, or programmatically using this hook:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Enables "Did you mean?" search corrections in SearchWP. | |
add_filter( 'searchwp_do_suggestions', function( $enabled, $args ) { | |
// $args contains the search arguments. | |
return true; | |
} ); |
With this feature enabled, SearchWP will automatically correct misspellings and output a note indicating that a correction has been made.
For additional information please see Automatic “Did you mean” (search query corrections)
Parameters
Parameter | Type | Description |
---|---|---|
$enabled |
Boolean |
Defaults to |
$args |
Array |
The arguments passed to the search algorithm |