comment_author_email()WP 0.71

Displays the author's email of the comment on the screen.

Hooks from the function

Returns

null.

Usage

<?php comment_author_email( $comment_ID ); ?>
$comment_ID(int/object)
ID or object of the comment, the email of the author of which needs to be displayed on the screen.
Default: current comment

Examples

0

#1 Display the commenter's email:

<a href="mailto:<?php comment_author_email(); ?>">contact
<?php comment_author(); ?></a>

*Note: it is not recommended to output the addresses, because spammers can collect them

Changelog

Since 0.71 Introduced.
Since 4.4.0 Added the ability for $comment_id to also accept a WP_Comment object.

comment_author_email() code WP 7.0

function comment_author_email( $comment_id = 0 ) {
	$comment = get_comment( $comment_id );

	$comment_author_email = get_comment_author_email( $comment );

	/**
	 * Filters the comment author's email for display.
	 *
	 * @since 1.2.0
	 * @since 4.1.0 The `$comment_id` parameter was added.
	 *
	 * @param string $comment_author_email The comment author's email address.
	 * @param string $comment_id           The comment ID as a numeric string.
	 */
	echo apply_filters( 'author_email', $comment_author_email, $comment->comment_ID );
}