comment_author
Filters the comment author's name for display.
Usage
add_filter( 'comment_author', 'wp_kama_comment_author_filter', 10, 2 ); /** * Function for `comment_author` filter-hook. * * @param string $author The comment author's username. * @param string $comment_ID The comment ID as a numeric string. * * @return string */ function wp_kama_comment_author_filter( $author, $comment_ID ){ // filter... return $author; }
- $author(string)
- The comment author's username.
- $comment_ID(string)
- The comment ID as a numeric string.
Changelog
Since 1.2.0 | Introduced. |
Since 4.1.0 | The $comment_ID parameter was added. |
Where the hook is called
comment_author
wp-includes/comment-template.php 74
echo apply_filters( 'comment_author', $author, $comment->comment_ID );
Where the hook is used in WordPress
wp-admin/includes/class-wp-comments-list-table.php 44
add_filter( 'comment_author', array( $this, 'floated_admin_avatar' ), 10, 2 );
wp-includes/default-filters.php 147
add_filter( $filter, 'wptexturize' );
wp-includes/default-filters.php 148
add_filter( $filter, 'convert_chars' );
wp-includes/default-filters.php 149
add_filter( $filter, 'esc_html' );