Note: You are viewing the documentation for Version 3View Version 4 Docs

Documentation

View the installation guide, browse the Knowledge Base, find out about SearchWP's many hooks, get support

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

Fix keyword search on your site. No coding required!

Now you can utilize all of the content that's gone unrecognized by native WordPress keyword search instantly with SearchWP

Get SearchWP