钩子文档

get_comment_author_email

💡 云策文档标注

概述

get_comment_author_email 是一个 WordPress 过滤器,用于修改评论作者返回的电子邮件地址。它允许开发者在获取评论作者邮箱时进行自定义处理。

关键要点

  • 过滤器名称:get_comment_author_email
  • 参数:$comment_author_email(评论作者邮箱字符串)、$comment_id(评论ID数字字符串)、$comment(WP_Comment对象)
  • 用途:过滤评论作者的邮箱地址,常用于安全、格式化或动态修改场景
  • 相关函数:get_comment_author_email() 用于检索当前评论作者的邮箱
  • 版本历史:从 WordPress 1.5.0 引入,4.1.0 版本添加了 $comment_id 和 $comment 参数

📄 原文内容

Filters the comment author’s returned email address.

Parameters

$comment_author_emailstring
The comment author’s email address.
$comment_idstring
The comment ID as a numeric string.
$commentWP_Comment
The comment object.

Source

return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment );

Changelog

Version Description
4.1.0 The $comment_id and $comment parameters were added.
1.5.0 Introduced.