钩子文档

wp_password_change_notification_email

💡 云策文档标注

概述

本文档介绍了 wp_password_change_notification_email 过滤器,用于自定义发送给站点管理员密码更改通知邮件的参数。该过滤器允许开发者修改邮件的内容、主题、收件人等属性。

关键要点

  • wp_password_change_notification_email 是一个 WordPress 过滤器,用于修改密码更改通知邮件的参数数组。
  • 过滤器参数包括 $wp_password_change_notification_email(用于构建 wp_mail() 的数组)、$user(用户对象)和 $blogname(站点标题)。
  • 该过滤器在 wp_password_change_notification() 函数中被调用,用于通知管理员用户密码更改事件。

代码示例

$wp_password_change_notification_email = apply_filters( 'wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname );

注意事项

  • 该过滤器从 WordPress 4.9.0 版本开始引入。
  • 开发者应确保修改后的参数数组符合 wp_mail() 函数的要求,以避免邮件发送失败。

📄 原文内容

Filters the contents of the password change notification email sent to the site admin.

Parameters

$wp_password_change_notification_emailarray
Used to build wp_mail() .

  • to string
    The intended recipient – site admin email address.
  • subject string
    The subject of the email.
  • message string
    The body of the email.
  • headers string
    The headers of the email.

$userWP_User
User object for user whose password was changed.
$blognamestring
The site title.

Source

$wp_password_change_notification_email = apply_filters( 'wp_password_change_notification_email', $wp_password_change_notification_email, $user, $blogname );

Changelog

Version Description
4.9.0 Introduced.