get_comment_excerpt()
Retrieve the excerpt of the current comment.
Returns a maximum of 20 words with an ellipsis appended if necessary.
Used By: comment_excerpt()
1 time — 0.000609 sec (slow) | 50000 times — 5 sec (fast)
Hooks from the function
Return
String
. The possibly truncated comment excerpt.
Usage
get_comment_excerpt( $comment_id );
- $comment_id(int|WP_Comment)
- WP_Comment or ID of the comment for which to get the excerpt.
Default: current comment
Examples
#1 Cut the text of the comment to 20 words, if it is more.
echo get_comment_excerpt( 1024 ); // output: // Looked at Get Recent Comments - messed up a mountain of code :) Tested my code queries creates a standard function of WordPress..
Changelog
Since 1.5.0 | Introduced. |
Since 4.4.0 | Added the ability for $comment_id to also accept a WP_Comment object. |