Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Created January 23, 2015 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/cf7e690e0c8d24f2b497 to your computer and use it in GitHub Desktop.
Save jchristopher/cf7e690e0c8d24f2b497 to your computer and use it in GitHub Desktop.
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