wp_trim_words filter-hookWP 3.3.0

Filters the text content after words have been trimmed.

Usage

add_filter( 'wp_trim_words', 'wp_kama_trim_words_filter', 10, 4 );

/**
 * Function for `wp_trim_words` filter-hook.
 * 
 * @param string $text          The trimmed text.
 * @param int    $num_words     The number of words to trim the text to.
 * @param string $more          An optional string to append to the end of the trimmed text, e.g. ….
 * @param string $original_text The text before it was trimmed.
 *
 * @return string
 */
function wp_kama_trim_words_filter( $text, $num_words, $more, $original_text ){

	// filter...
	return $text;
}
$text(string)
The trimmed text.
$num_words(int)
The number of words to trim the text to.
Default: 55
$more(string)
An optional string to append to the end of the trimmed text, e.g. ….
$original_text(string)
The text before it was trimmed.

Changelog

Since 3.3.0 Introduced.

Where the hook is called

wp_trim_words()
wp_trim_words
wp-includes/formatting.php 4095
return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );

Where the hook is used in WordPress

Usage not found.