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

Documentation

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

Available since: 1.0

searchwp_terms

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:

<?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

Parameters

Parameter Type Description
$query Array|String

The search query as it was submitted

$engine String

The search engine being used for this search

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