This Documentation is for SearchWP Version 3

Available since: 1.0


View Parameters »

Note: Use of this hook will require a manual reindex

SearchWP runs all terms through it’s own sanitization method by default, but sometimes it’s too strict and you want to modify it.

Example: If you have a search engine for which you’d like to disable automatic term sanitization, add the following to your active theme’s functions.php:

function my_searchwp_sanitize_terms( $enabled, $engine )
if( $engine == 'default' ) {
// if it's the default engine, use SearchWP's sanitizing
return true;
} else {
// for supplemental engines disable automatic sanitization
return false;
add_filter( 'searchwp_sanitize_terms', 'my_searchwp_sanitize_terms', 10, 2 );
view raw gistfile1.php hosted with ❤ by GitHub


Parameter Type Description
$enabled Boolean

Whether internal term sanitization will take place

$engine String

The search engine currently in use