Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Last active April 26, 2019 14:33
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/152edd90d67aaffe778e to your computer and use it in GitHub Desktop.
Save jchristopher/152edd90d67aaffe778e to your computer and use it in GitHub Desktop.
Remove specific words from SearchWP's default stopwords list without removing/replacing them all
<?php
function my_searchwp_stopwords( $terms ) {
// we DO NOT want to ignore 'first' so remove it from the list of common words
$words_to_keep = array( 'first' );
$terms = array_diff( $terms, $words_to_keep );
return $terms;
}
add_filter( 'searchwp_stopwords', 'my_searchwp_stopwords' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment