钩子文档

email_change_email

💡 云策文档标注

概述

email_change_email 是一个 WordPress 过滤器钩子,用于自定义用户邮箱更改时发送的邮件内容。它允许开发者修改邮件的收件人、主题、消息和头部等参数。

关键要点

  • 这是一个过滤器钩子,用于过滤用户邮箱更改时发送的邮件内容。
  • 参数包括 $email_change_email(数组,用于构建 wp_mail())、$user(原始用户数组)和 $userdata(更新后的用户数组)。
  • 邮件消息中可以使用动态替换字符串,如 ###USERNAME###、###ADMIN_EMAIL###、###NEW_EMAIL###、###EMAIL###、###SITENAME### 和 ###SITEURL###。
  • 从 WordPress 4.3.0 版本开始引入。

📄 原文内容

Filters the contents of the email sent when the user’s email is changed.

Parameters

$email_change_emailarray
Used to build wp_mail() .

  • to string
    The intended recipients.
  • subject string
    The subject of the email.
  • message string
    The content of the email.
    The following strings have a special meaning and will get replaced dynamically:

    • ###USERNAME### The current user’s username.
    • ###ADMIN_EMAIL### The admin email in case this was unexpected.
    • ###NEW_EMAIL### The new email address.
    • ###EMAIL### The old email address.
    • ###SITENAME### The name of the site.
    • ###SITEURL### The URL to the site.
  • headers string
    Headers.

$userarray
The original user array.
$userdataarray
The updated user array.

Source

$email_change_email = apply_filters( 'email_change_email', $email_change_email, $user, $userdata );

Changelog

Version Description
4.3.0 Introduced.