WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get comment excerpt

Description

Retrieve the excerpt of the current comment.

Will cut each word and only output the first 20 words with '…' at the end. If the word count is less than 20, then no truncating is done and no '…' will appear.

Usage

 <?php get_comment_excerpt$comment_ID ); ?> 

Parameters

$comment_ID
(int) (optional) ID of the comment for which to get the excerpt.
Default: 0 (the current comment)

Returns

(string) 
The maybe truncated comment with 20 words or less.

Examples

<?php
	$excerpt = get_comment_excerpt( 7 );
	echo '<p>Latest comment: ' . $excerpt . '</p>';
?>

Notes

Change Log

Source File

get_comment_excerpt() is located in wp-includes/comment-template.php

Related

Comments Functions