comment_author_email

Display the email of the author of the current global $comment.

Description

comment_author_email( (int) $comment_ID = 0 ); 

Care should be taken to protect the email address and assure that email harvesters do not capture your commentors' email address. Most assume that their email address will not appear in raw form on the site. Doing so will enable anyone, including those that people don't want to get the email address and use it for their own means good and bad.

Parameters (1)

0. $comment_id — Optional. (int)
WP_Comment or the ID of the comment for which to print the author's email.

Usage

  1. if ( !function_exists( 'comment_author_email' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment-template.php'; 
  3.  
  4. // Optional. WP_Comment or the ID of the comment for which to print the author's email. 
  5. // Default current comment. 
  6. $comment_id = -1; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = comment_author_email($comment_id); 
  10.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/comment-template.php  
  1. function comment_author_email( $comment_ID = 0 ) { 
  2. $comment = get_comment( $comment_ID ); 
  3. $author_email = get_comment_author_email( $comment ); 
  4.  
  5. /** 
  6. * Filters the comment author's email for display. 
  7. * @since 1.2.0 
  8. * @since 4.1.0 The `$comment_ID` parameter was added. 
  9. * @param string $author_email The comment author's email address. 
  10. * @param int $comment_ID The comment ID. 
  11. */ 
  12. echo apply_filters( 'author_email', $author_email, $comment->comment_ID );