SearchWP

This Documentation is for SearchWP Version 3

Available since: 3.0

searchwp_th_num_words

View Parameters »

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

<?php
// 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

Parameters

Parameter Type Description
$length Integer

Length (in words) of generated excerpts