send_email_change_email
云策文档标注
概述
send_email_change_email 是一个 WordPress 过滤器,用于控制是否在用户邮箱更改时发送通知邮件。它通常与 wp_update_user() 函数结合使用,允许开发者自定义邮件发送行为。
关键要点
- 过滤器名称:send_email_change_email
- 用途:过滤是否发送邮箱更改邮件
- 参数:$send(布尔值,是否发送邮件)、$user(原始用户数组)、$userdata(更新后的用户数组)
- 引入版本:4.3.0
- 相关函数:wp_update_user()
代码示例
add_filter( 'send_email_change_email', '__return_false' );注意事项
在开发环境中,批量更新用户信息时禁用此邮件可以避免干扰。建议根据用户 ID 条件返回 false,以确保非自身更改时仍发送通知。
原文内容
Filters whether to send the email change email.
Description
See also
- wp_insert_user(): For
$userand$userdatafields.
Parameters
$sendbool-
Whether to send the email.
$userarray-
The original user array.
$userdataarray-
The updated user array.
Source
$send_email_change_email = apply_filters( 'send_email_change_email', true, $user, $userdata );
Changelog
| Version | Description |
|---|---|
| 4.3.0 | Introduced. |
Skip to note 2 content
oyvindeikeland
To disable the automatic email response to users when their password or email is changed, include this in your functions.php.
/* * Disable User Notification of Password Change Confirmation */ add_filter( 'send_email_change_email', '__return_false' );This is useful during development when setting up many user accounts at once and you have to change their information. It might be better to only return false if this is not your user id, so the notification still gets delivered if it’s not you doing the changes.