钩子文档

new_network_admin_email_content

💡 云策文档标注

概述

new_network_admin_email_content 是一个 WordPress 过滤器钩子,用于自定义尝试更改网络管理员电子邮件地址时发送的邮件内容。它允许开发者修改邮件文本,并支持动态替换特定占位符字符串。

关键要点

  • 这是一个过滤器钩子,用于修改网络管理员电子邮件更改确认邮件的文本内容。
  • 邮件文本中包含特殊占位符,如 ###USERNAME###、###ADMIN_URL###、###EMAIL###、###SITENAME### 和 ###SITEURL###,这些会在发送时被动态替换为实际值。
  • 钩子接受参数:$email_text(邮件文本字符串)、$new_admin_email(包含新电子邮件地址相关数据的数组)。
  • 在 WordPress 4.9.0 版本中引入。

代码示例

$content = apply_filters( 'new_network_admin_email_content', $email_text, $new_admin_email );

注意事项

  • 确保在修改邮件文本时保留占位符的格式,以便 WordPress 能正确替换动态内容。
  • 此钩子与 update_network_option_new_admin_email() 函数关联,用于发送确认请求邮件。

📄 原文内容

Filters the text of the email sent when a change of network admin 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 proposed new network admin email address.
  • ###SITENAME### The name of the network.
  • ###SITEURL### The URL to the network.

Parameters

$email_textstring
Text in the email.
$new_admin_emailarray
Data relating to the new network admin email address.

  • hash string
    The secure hash used in the confirmation link URL.
  • newemail string
    The proposed new network admin email address.

Source

$content = apply_filters( 'new_network_admin_email_content', $email_text, $new_admin_email );

Changelog

Version Description
4.9.0 Introduced.