Welcome, visitor! Log in
 

Source View: comment_excerpt_length

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
569      $words = explode( ' ', $comment_text );
570
571      /**
572       * Filter the amount of words used in the comment excerpt.
573       *
574       * @since 4.4.0
575       *
576       * @param int $comment_excerpt_length The amount of words you want to display in the comment excerpt.
577       */
578      $comment_excerpt_length = apply_filters( 'comment_excerpt_length', 20 );
579
580      $use_ellipsis = count( $words ) > $comment_excerpt_length;
581      if ( $use_ellipsis ) {
582           $words = array_slice( $words, 0, $comment_excerpt_length );
583      }
584
585      $excerpt = trim( join( ' ', $words ) );
586      if ( $use_ellipsis ) {
587           $excerpt .= '…';