This Documentation is for SearchWP Version 3

Available since: 1.0


View Parameters »

Allows you to modify a search query after it was submitted but before SearchWP sanitizes it and subsequently performs the search.

Example: If you want to correct a common spelling mistake, add the following to your active theme’s functions.php:

// if your visitors commonly misspell "soccer" as "socer" you can fix that for them
function my_parse_searchwp_terms( $query, $engine ) {
if( false !== strpos( strtolower( $query ), 'socer' ) ) {
$query = str_replace( 'socer', 'soccer', strtolower( $query ) );
return $query;
add_filter( 'searchwp_terms', 'my_parse_searchwp_terms', 10, 2 );
view raw gistfile1.php hosted with ❤ by GitHub


Parameter Type Description
$query Array|String

The search query as it was submitted

$engine String

The search engine being used for this search

[wpforms id="3080"]