get_comment_author_email

函数
get_comment_author_email ( $comment_ID = 0 )
参数
  • (int|WP_Comment) $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's email. Default current comment.
    Required:
返回值
  • (string) The current comment author's email
定义位置
相关方法
get_comment_author_email_linkcomment_author_emailget_comment_author_ipget_comment_author_urlget_comment_author
引入
1.5.0
弃用
-

get_comment_author_email: 这个函数返回评论的作者的电子邮件地址。它需要一个参数,即$comment_ID,这是你想检索作者电子邮件的评论的ID。

检索当前评论的作者的电子邮件。

function get_comment_author_email( $comment_ID = 0 ) {
	$comment = get_comment( $comment_ID );

	/**
	 * Filters the comment author's returned email address.
	 *
	 * @since 1.5.0
	 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
	 *
	 * @param string     $comment_author_email The comment author's email address.
	 * @param string     $comment_ID           The comment ID as a numeric string.
	 * @param WP_Comment $comment              The comment object.
	 */
	return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment );
}

常见问题

FAQs
查看更多 >