Filter hook 'get_comment'

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

View Source

get_comment

Filter Hook
Description
Fires after a comment is retrieved.

Hook Information

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

Hook Parameters

Type Name Description
WP_Comment $_comment Comment data.

Usage Examples

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

function my_custom_filter($_comment) {
    // Your custom filtering logic here
    return $_comment;
}

Source Code Context

wp-includes/comment.php:245 - How this hook is used in WordPress core
<?php
 240  	 *
 241  	 * @since 2.3.0
 242  	 *
 243  	 * @param WP_Comment $_comment Comment data.
 244  	 */
 245  	$_comment = apply_filters( 'get_comment', $_comment );
 246  
 247  	if ( OBJECT === $output ) {
 248  		return $_comment;
 249  	} elseif ( ARRAY_A === $output ) {
 250  		return $_comment->to_array();

PHP Documentation

<?php
/**
	 * Fires after a comment is retrieved.
	 *
	 * @since 2.3.0
	 *
	 * @param WP_Comment $_comment Comment data.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.