Filter hook 'comment_excerpt'

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

View Source

comment_excerpt

Filter Hook
Description
Filters the comment excerpt for display.

Hook Information

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

Hook Parameters

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

Usage Examples

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

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

Source Code Context

wp-includes/comment-template.php:717 - How this hook is used in WordPress core
<?php
 712  	 * @since 4.1.0 The `$comment_id` parameter was added.
 713  	 *
 714  	 * @param string $comment_excerpt The comment excerpt text.
 715  	 * @param string $comment_id      The comment ID as a numeric string.
 716  	 */
 717  	echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );
 718  }
 719  
 720  /**
 721   * Retrieves the comment ID of the current comment.
 722   *

PHP Documentation

<?php
/**
	 * Filters the comment excerpt for display.
	 *
	 * @since 1.2.0
	 * @since 4.1.0 The `$comment_id` parameter was added.
	 *
	 * @param string $comment_excerpt The comment excerpt text.
	 * @param string $comment_id      The comment ID as a numeric string.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/comment-template.php
Related Hooks

Related hooks will be displayed here in future updates.