new_user_email_content
云策文档标注
概述
new_user_email_content 是一个 WordPress 过滤器钩子,用于自定义用户尝试更改邮箱地址时发送的邮件内容。它允许开发者替换邮件文本中的动态占位符,如用户名和确认链接。
关键要点
- 过滤器钩子:new_user_email_content,用于修改用户邮箱更改确认邮件的文本内容。
- 动态占位符:邮件文本支持特殊字符串替换,包括 ###USERNAME###、###ADMIN_URL###、###EMAIL###、###SITENAME### 和 ###SITEURL###。
- 参数:接受 $email_text(邮件文本)、$new_user_email(新邮箱相关数据数组,包含 hash 和 newemail 等字段)。
- 应用场景:常用于 send_confirmation_on_profile_email() 函数中,发送邮箱更改确认请求。
代码示例
$content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );注意事项
- 此钩子自 WordPress 4.9.0 版本引入,适用于多站点(MU)环境。
- 确保在自定义邮件内容时正确处理动态占位符,以保持邮件功能正常。
原文内容
Filters the text of the email sent when a change of user email address is attempted.
Description
The following strings have a special meaning and will get replaced dynamically:
###USERNAME###The current user’s username.###ADMIN_URL###The link to click on to confirm the email change.###EMAIL###The new email.###SITENAME###The name of the site.###SITEURL###The URL to the site.
Parameters
$email_textstring-
Text in the email.
$new_user_emailarray-
Data relating to the new user email address.
hashstringThe secure hash used in the confirmation link URL.newemailstringThe proposed new email address.
Source
$content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );
Changelog
| Version | Description |
|---|---|
| MU (3.0.0) | MU (3.0.0) |
| 4.9.0 | Introduced. |