SearchWP

This Documentation is for SearchWP Version 3

Available since: 1.4.2

searchwp_custom_stemmer

View Parameters »

Note: You should review this filter before installing SearchWP

SearchWP ships with a single language stemmer that’s used to generate keyword stems for searches. If you run a non-English website and would prefer to use your own stemmer, this filter makes that possible.

Example: To tell SearchWP to utilize your own stemmer when generating keyword stems, add the following to your active theme’s functions.php:

<?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' );
view raw gistfile1.php hosted with ❤ by GitHub

Parameters

Parameter Type Description
$unstemmed String

The unstemmed keyword