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


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

Available since: 3.0


View Parameters »

When highlighting is enabled SearchWP can generate its own excerpts. This hook controls how many words are used to form those excerpts.

// When highlighting, tell SearchWP to generate excerpts that are 75 words long.
add_filter( 'searchwp_th_num_words', function( $length ) {
return 75;
} );
view raw functions.php hosted with ❤ by GitHub


Parameter Type Description
$length Integer

Length (in words) of generated excerpts

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