get_comment_author
Filters the returned comment author name.
Использование
add_filter( 'get_comment_author', 'wp_kama_get_comment_author_filter', 10, 3 );
/**
* Function for `get_comment_author` filter-hook.
*
* @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.
*
* @return string
*/
function wp_kama_get_comment_author_filter( $comment_author, $comment_id, $comment ){
// filter...
return $comment_author;
}
- $comment_author(строка)
- The comment author's username.
- $comment_id(строка)
- The comment ID as a numeric string.
- $comment(WP_Comment)
- The comment object.
Список изменений
| С версии 1.5.0 | Введена. |
| С версии 4.1.0 | The $comment_id and $comment parameters were added. |
Где вызывается хук
get_comment_author
wp-includes/comment-template.php 56
return apply_filters( 'get_comment_author', $comment_author, $comment_id, $comment );