WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/comment author

Description

Displays the comment author name; that is, the one supplied by the commenter. If no name is provided (and "User must fill out name and email" is not enabled under Discussion Options), WordPress will assign "Anonymous" as comment author.

Use get_comment_author() to retrieve the value.

Usage

 <?php comment_author$comment_ID ); ?> 

Example

<div>Comment by <?php comment_author(); ?>:</div>

Parameters

comment_ID
(integer) (optional) The ID of the comment for which to print the author
Default: 0 (the current comment)

Filters

apply_filters() Calls 'comment_author' on comment author before displaying

Changelog

  •  ? : Added the 'comment_ID' parameter.
  • Since: 0.71

Source Code

comment_author() is located in wp-includes/comment-template.php.

Related

Comments Functions

See also index of Function Reference and index of Template Tags.