钩子文档

automatic_updates_debug_email

💡 云策文档标注

概述

本文档介绍了 WordPress 中的 automatic_updates_debug_email 过滤器,用于自定义自动后台核心更新后发送的调试邮件内容。开发者可以通过此过滤器修改邮件的收件人、主题、正文和头部信息。

关键要点

  • automatic_updates_debug_email 是一个过滤器,允许在自动后台核心更新后自定义调试邮件。
  • 过滤器接收三个参数:$email(包含收件人、主题、正文和头部的数组)、$failures(升级失败次数)和 $results(更新结果)。
  • 开发者可以修改 $email 数组中的 to、subject、body 和 headers 字段来调整邮件内容。

代码示例

$email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results );

注意事项

  • 此过滤器在 WordPress 3.8.0 版本中引入,用于调试和记录更新过程。
  • 邮件收件人可以是单个邮箱地址或数组,由 wp_mail() 函数处理。
  • 开发者应确保修改后的邮件格式符合 wp_mail() 的要求,以避免发送失败。

📄 原文内容

Filters the debug email that can be sent following an automatic background core update.

Parameters

$emailarray
Array of email arguments that will be passed to wp_mail() .

  • to string
    The email recipient. An array of emails can be returned, as handled by wp_mail() .
  • subject string
    Email subject.
  • body string
    Email message body.
  • headers string
    Any email headers. Default empty.

$failuresint
The number of failures encountered while upgrading.
$resultsmixed
The results of all attempted updates.

Source

$email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results );

Changelog

Version Description
3.8.0 Introduced.