Filter hook 'get_comment_type'

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

View Source

get_comment_type

Filter Hook
Description
Filters the returned comment type.

Hook Information

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

Hook Parameters

Type Name Description
string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
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_type
add_filter('get_comment_type', 'my_custom_filter', 10, 3);

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

Source Code Context

wp-includes/comment-template.php:1179 - How this hook is used in WordPress core
<?php
1174  	 *
1175  	 * @param string     $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
1176  	 * @param string     $comment_id   The comment ID as a numeric string.
1177  	 * @param WP_Comment $comment      The comment object.
1178  	 */
1179  	return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment );
1180  }
1181  
1182  /**
1183   * Displays the comment type of the current comment.
1184   *

PHP Documentation

<?php
/**
	 * Filters the returned comment type.
	 *
	 * @since 1.5.0
	 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
	 *
	 * @param string     $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
	 * @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.