Filter hook 'get_comment_excerpt'

in WP Core File wp-includes/comment-template.php at line 691

View Source

get_comment_excerpt

Filter Hook
Description
Filters the retrieved comment excerpt.

Hook Information

File Location wp-includes/comment-template.php View on GitHub
Hook Type Filter
Line Number 691

Hook Parameters

Type Name Description
string $comment_excerpt The comment excerpt text.
string $comment_id The comment ID as a numeric string.
WP_Comment $comment The comment object.

Usage Examples

Basic Usage
<?php
// Hook into get_comment_excerpt
add_filter('get_comment_excerpt', 'my_custom_filter', 10, 3);

function my_custom_filter($comment_excerpt, $comment_id, $comment) {
    // Your custom filtering logic here
    return $comment_excerpt;
}

Source Code Context

wp-includes/comment-template.php:691 - How this hook is used in WordPress core
<?php
 686  	 *
 687  	 * @param string     $comment_excerpt The comment excerpt text.
 688  	 * @param string     $comment_id      The comment ID as a numeric string.
 689  	 * @param WP_Comment $comment         The comment object.
 690  	 */
 691  	return apply_filters( 'get_comment_excerpt', $comment_excerpt, $comment->comment_ID, $comment );
 692  }
 693  
 694  /**
 695   * Displays the excerpt of the current comment.
 696   *

PHP Documentation

<?php
/**
	 * Filters the retrieved comment excerpt.
	 *
	 * @since 1.5.0
	 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
	 *
	 * @param string     $comment_excerpt The comment excerpt text.
	 * @param string     $comment_id      The comment ID as a numeric string.
	 * @param WP_Comment $comment         The comment object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/comment-template.php
Related Hooks

Related hooks will be displayed here in future updates.