万が一、当サイトで重大な問題を発見した際などは、フォーラムや WordSlack #docs チャンネルでお知らせください。</p>
関数リファレンス/get comment author email
コメント投稿者のメールアドレスを、表示するのではなく、取得します。
使い方
<?php $author = get_comment_author_email( $comment_ID ); ?>
パラメータ
- $comment_ID
- (整数) (オプション) 投稿者のメールアドレスを取得するコメントの ID。
- 初期値: 0 – 現在のコメント
戻り値
- (文字列)
- コメント投稿者のメールアドレス
用例
<?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; ?>
参考
変更履歴
新規導入: 1.5.0
ソースファイル
get_comment_author_email() は wp-includes/comment-template.php
にあります。
関連資料
コメント関数: cancel_comment_reply_link(), comment_author(), comment_author_email(), comment_author_email_link(), comment_author_IP(), comment_author_link(), comment_author_rss(), comment_author_url(), comment_author_url_link(), comment_class(), comment_date(), comment_excerpt(), comment_form_title(), comment_form(), comment_ID(), comment_id_fields() / en, comment_reply_link(), comment_text(), comment_text_rss(), comment_time(), comment_type(), comments_link, comments_number(), comments_open(), comments_popup_link(), comments_popup_script(), comments_rss_link(), get_avatar(), next_comments_link(), paginate_comments_links(), permalink_comments_rss(), previous_comments_link(), wp_list_comments()
最新英語版: WordPress Codex » Template Tags/get_comment_author_email (最新版との差分)