钩子文档

comment_notification_subject

💡 云策文档标注

概述

comment_notification_subject 是一个 WordPress 过滤器钩子,用于修改评论通知邮件的主题行。它允许开发者自定义邮件主题内容,基于评论 ID 进行动态调整。

关键要点

  • 这是一个过滤器钩子,用于过滤评论通知邮件的主题字符串。
  • 接受两个参数:$subject(邮件主题字符串)和 $comment_id(评论 ID 作为数字字符串)。
  • 在 wp_notify_postauthor() 函数中被调用,用于通知文章作者有关评论、引用或 pingback。
  • 自 WordPress 1.5.2 版本引入。

代码示例

$subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID );

📄 原文内容

Filters the comment notification email subject.

Parameters

$subjectstring
The comment notification email subject.
$comment_idstring
Comment ID as a numeric string.

Source

$subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID );

Changelog

Version Description
1.5.2 Introduced.