get_comment_author
Filter HookDescription
Filters the returned comment author name.Hook Information
File Location |
wp-includes/comment-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 56 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$comment_author
|
The comment author's username. |
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_author
add_filter('get_comment_author', 'my_custom_filter', 10, 3);
function my_custom_filter($comment_author, $comment_id, $comment) {
// Your custom filtering logic here
return $comment_author;
}
Source Code Context
wp-includes/comment-template.php:56
- How this hook is used in WordPress core
<?php
51 *
52 * @param string $comment_author The comment author's username.
53 * @param string $comment_id The comment ID as a numeric string.
54 * @param WP_Comment $comment The comment object.
55 */
56 return apply_filters( 'get_comment_author', $comment_author, $comment_id, $comment );
57 }
58
59 /**
60 * Displays the author of the current comment.
61 *
PHP Documentation
<?php
/**
* Filters the returned comment author name.
*
* @since 1.5.0
* @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
*
* @param string $comment_author The comment author's username.
* @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.