SearchWP

This Documentation is for SearchWP Version 3

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:

<?php
// Enables "Did you mean?" search corrections in SearchWP.
add_filter( 'searchwp_do_suggestions', function( $enabled, $args ) {
// $args contains the search arguments.
return true;
} );
view raw functions.php hosted with ❤ by GitHub

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 false

$args Array

The arguments passed to the search algorithm

[wpforms id="3080"]