我必须编辑邮件内容,这是默认内容,以便在提交评论时向帖子作者发送通知。我需要通过替换现有的评论邮件内容来添加自定义内容。那么,是否有任何操作或功能可以用我的自定义模板覆盖此默认电子邮件模板。
如何编辑评论通知电子邮件内容?
1 个回复
最合适的回答,由SO网友:s_ha_dum 整理而成
可以将筛选器应用于comment_notification_text
:
1525 /**
1526 * Filter the comment notification email text.
1527 *
1528 * @since 1.5.2
1529 *
1530 * @param string $notify_message The comment notification email text.
1531 * @param int $comment_id Comment ID.
1532 */
1533 $notify_message = apply_filters( \'comment_notification_text\', $notify_message, $comment->comment_ID );
如果您需要进行大量更改,因为包含该挂钩的函数是可插入的,您可能会发现替换整个函数更容易。