Languages: English • 日本語 (Add your language)
Retrieve the comment author's email address rather than echo it.
<?php $author = get_comment_author_email( $comment_ID ); ?>
<?php if ( $comments ) : ?> <ol> <?php foreach( $comments as $comment ) : ?> <li id="comment-<?php comment_ID(); ?>"> <?php if ( $comment->comment_approved == '0' ) : ?> <p>Your comment is awaiting approval</p> <?php endif; ?> <?php comment_text(); ?> <?php echo get_avatar( get_comment_author_email(), $size, $default_avatar ); ?> <cite> <?php comment_type(); ?> by <?php comment_author_link(); ?> on <?php comment_date(); ?> at <?php comment_time(); ?> </cite> </li> <?php endforeach; ?> </ol> <?php else : ?> <p>No comments yet</p> <?php endif; ?>
Since: 1.5.0
get_comment_author_email() is located in wp-includes/comment-template.php