excerpt_length
Filters the maximum number of words in a post excerpt.
Использование
add_filter( 'excerpt_length', 'wp_kama_excerpt_length_filter' );
/**
* Function for `excerpt_length` filter-hook.
*
* @param int $number The maximum number of words.
*
* @return int
*/
function wp_kama_excerpt_length_filter( $number ){
// filter...
return $number;
}
- $number(int)
- The maximum number of words.
По умолчанию: 55
Список изменений
| С версии 2.7.0 | Введена. |
Где вызывается хук
excerpt_length
wp-includes/formatting.php 4019
$excerpt_length = (int) apply_filters( 'excerpt_length', $excerpt_length );
wp-includes/blocks/latest-posts.php 159
$excerpt_length = (int) apply_filters( 'excerpt_length', $block_core_latest_posts_excerpt_length );
Где используется хук в WordPress
wp-includes/blocks/latest-posts.php 199
remove_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );
wp-includes/blocks/latest-posts.php 56
add_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );