WordPress.org

Ready to get started?Download WordPress

Codex

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

Template Tags/get comment author email

This page is marked as incomplete. You can help Codex by expanding it.

Contents

Description

Retrieve the comment author's email address rather than echo it.

Usage

<?php $author get_comment_author_email$comment_ID ); ?>

Parameters

$comment_ID
(integer) (optional) The ID of the comment for which to retrieve the author's email.
Default: 0 (current comment)

Return Values

(string) 
The comment author's email address

Examples

<?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; ?>

Notes

Change Log

Since: 1.5.0

Source File

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

Related