auto_core_update_send_email
云策文档标注
概述
auto_core_update_send_email 是一个 WordPress 过滤器,用于控制是否在自动后台核心更新后发送电子邮件通知。它允许开发者根据更新类型和结果自定义邮件发送行为。
关键要点
- 过滤器名称:auto_core_update_send_email
- 用途:过滤是否发送自动核心更新后的电子邮件
- 参数:$send(布尔值,默认 true)、$type(字符串,如 'success'、'fail'、'critical')、$core_update(对象,更新尝试)、$result(混合类型,可以是 WP_Error)
- 引入版本:3.7.0
- 相关函数:WP_Automatic_Updater::send_email()
注意事项
用户反馈建议此 Hook 可按用户定制,例如在多管理员场景下选择性通知。
原文内容
Filters whether to send an email following an automatic background core update.
Parameters
$sendbool-
Whether to send the email. Default true.
$typestring-
The type of email to send. Can be one of
'success','fail','critical'. $core_updateobject-
The update offer that was attempted.
$resultmixed-
The result for the core update. Can be WP_Error.
Source
if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) {
Changelog
| Version | Description |
|---|---|
| 3.7.0 | Introduced. |
Skip to note 2 content
Alastair Irvine
It would be really great if this hook could be per-user, e.g. what if you have multiple admin users for a WP installation and not all of them want to be notified when an aut-update happens?