comment_excerpt_length
Filter HookDescription
Filters the maximum number of words used in the comment excerpt.Hook Information
File Location |
wp-includes/comment-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 677 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$comment_excerpt_length
|
The amount of words you want to display in the comment excerpt. |
Usage Examples
Basic Usage
<?php
// Hook into comment_excerpt_length
add_filter('comment_excerpt_length', 'my_custom_filter', 10, 1);
function my_custom_filter($comment_excerpt_length) {
// Your custom filtering logic here
return $comment_excerpt_length;
}
Source Code Context
wp-includes/comment-template.php:677
- How this hook is used in WordPress core
<?php
672 *
673 * @since 4.4.0
674 *
675 * @param int $comment_excerpt_length The amount of words you want to display in the comment excerpt.
676 */
677 $comment_excerpt_length = apply_filters( 'comment_excerpt_length', $comment_excerpt_length );
678
679 $comment_excerpt = wp_trim_words( $comment_text, $comment_excerpt_length, '…' );
680
681 /**
682 * Filters the retrieved comment excerpt.
PHP Documentation
<?php
/**
* Filters the maximum number of words used in the comment excerpt.
*
* @since 4.4.0
*
* @param int $comment_excerpt_length The amount of words you want to display in the comment excerpt.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/comment-template.php
Related Hooks
Related hooks will be displayed here in future updates.