Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Last active November 7, 2016 15:58
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/8552354 to your computer and use it in GitHub Desktop.
Save jchristopher/8552354 to your computer and use it in GitHub Desktop.
Tell SearchWP to use a different stemmer when generating keyword stems
<?php
// Tell SearchWP we have a stemmer
add_filter( 'searchwp_keyword_stem_locale', '__return_true' );
function my_searchwp_custom_stemmer( $unstemmed ) {
$stemmer = new My_Stemmer(); // use your own custom stemmer
$stemmed = $stemmer->get_stem( $unstemmed ); // get the stem
return $stemmed;
}
add_filter( 'searchwp_custom_stemmer', 'my_searchwp_custom_stemmer' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment