comment_email
云策文档标注
概述
comment_email 是一个 WordPress 过滤器,用于在显示评论作者邮箱时进行过滤。开发者需注意保护邮箱地址,防止被邮件采集器捕获。
关键要点
- 过滤器名称:comment_email
- 参数:$comment_author_email(评论作者邮箱字符串)和 $comment(WP_Comment 对象)
- 用途:过滤评论作者邮箱以安全显示,避免泄露
- 相关函数:WP_Comments_List_Table::column_author() 和 get_comment_author_email_link()
- 版本历史:从 1.2.0 引入,4.1.0 添加 $comment 参数
代码示例
$comment_author_email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );注意事项
使用此过滤器时,应采取措施保护邮箱地址,确保不被邮件采集器获取。
原文内容
Filters the comment author’s email for display.
Description
Care should be taken to protect the email address and assure that email harvesters do not capture your commenter’s email address.
Parameters
$comment_author_emailstring-
The comment author’s email address.
$commentWP_Comment-
The comment object.
Source
$comment_author_email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );