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
:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Parameters
Parameter | Type | Description |
---|---|---|
$enabled |
Boolean |
Whether internal term sanitization will take place |
$engine |
String |
The search engine currently in use |