钩子文档

comment_notification_text

💡 云策文档标注

概述

comment_notification_text 是一个 WordPress 过滤器,用于修改评论通知邮件的文本内容。它允许开发者自定义发送给文章作者或其他用户的评论通知邮件消息。

关键要点

  • 过滤器名称:comment_notification_text
  • 参数:$notify_message(字符串,评论通知邮件文本)和 $comment_id(字符串,评论 ID 作为数字字符串)
  • 应用场景:在 wp_notify_postauthor() 函数中调用,用于通知文章作者有关评论、trackback 或 pingback 的信息
  • 引入版本:WordPress 1.5.2

代码示例

$notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID );

📄 原文内容

Filters the comment notification email text.

Parameters

$notify_messagestring
The comment notification email text.
$comment_idstring
Comment ID as a numeric string.

Source

$notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID );

Changelog

Version Description
1.5.2 Introduced.