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_sanitize_terms

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:

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

Parameters

Parameter Type Description
$enabled Boolean

Whether internal term sanitization will take place

$engine String

The search engine currently in use

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