Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Customize the SearchWP Regex Whitelist
<?php
function my_searchwp_term_pattern_whitelist( $whitelist ) {
$my_whitelist = array(
"/\\b(IT)\\b/u", // always keep "IT" (all caps only!)
);
// we want our pattern to be considered the most specific
// so that false positive matches do not interfere
$whitelist = array_merge( $my_whitelist, $whitelist );
return $whitelist;
}
add_filter( 'searchwp_term_pattern_whitelist', 'my_searchwp_term_pattern_whitelist' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.