wp_trim_words хук-фильтрWP 3.3.0

Filters the text content after words have been trimmed.

Использование

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(строка)
The trimmed text.
$num_words(int)
The number of words to trim the text to.
По умолчанию: 55
$more(строка)
An optional string to append to the end of the trimmed text, e.g. ….
$original_text(строка)
The text before it was trimmed.

Список изменений

С версии 3.3.0 Введена.

Где вызывается хук

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

Где используется хук в WordPress

Использование не найдено.