wphooks.info - comment_excerpt_length

comment_excerpt_length

(trunk - 5.0-alpha-42177)

The hook occurs in the following file:

wp-includes/comment-template.php:
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
	$comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) );
	$words = explode( ' ', $comment_text );

	/**
	 * Filters the amount 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.
	 */
	$comment_excerpt_length = apply_filters( 'comment_excerpt_length', 20 );

	$use_ellipsis = count( $words ) > $comment_excerpt_length;
	if ( $use_ellipsis ) {
		$words = array_slice( $words, 0, $comment_excerpt_length );
	}

	$excerpt = trim( join( ' ', $words ) );
	if ( $use_ellipsis ) {
		$excerpt .= '…';