auto_theme_update_send_email
云策文档标注
概述
本文档介绍了 WordPress 中的 auto_theme_update_send_email 过滤器,用于控制自动后台主题更新后是否发送电子邮件通知。开发者可以通过此过滤器自定义通知行为,例如基于更新结果决定是否发送邮件。
关键要点
- auto_theme_update_send_email 是一个过滤器,用于管理自动主题更新后的电子邮件发送。
- 过滤器接受两个参数:$enabled(布尔值,表示通知是否启用)和 $update_results(数组,包含主题更新任务的结果)。
- 此过滤器在 WordPress 5.5.0 版本引入,并在 5.5.1 版本添加了 $update_results 参数。
- 相关函数 WP_Automatic_Updater::after_plugin_theme_update() 使用此过滤器来检查更新后是否应发送邮件。
代码示例
$notifications_enabled = apply_filters( 'auto_theme_update_send_email', true, $update_results['theme'] );
原文内容
Filters whether to send an email following an automatic background theme update.
Parameters
$enabledbool-
True if theme update notifications are enabled, false otherwise.
$update_resultsarray-
The results of theme update tasks.
Source
$notifications_enabled = apply_filters( 'auto_theme_update_send_email', true, $update_results['theme'] );