钩子文档

new_site_email

💡 云策文档标注

概述

new_site_email 是一个 WordPress 过滤器,用于在创建新站点时,修改发送给多站点网络管理员的通知邮件内容。此过滤器允许开发者自定义邮件的收件人、主题、正文和头部信息。

关键要点

  • 过滤器名称:new_site_email
  • 用途:过滤新站点创建时发送给网络管理员的邮件内容
  • 参数:$new_site_email(数组,用于构建 wp_mail())、$site(WP_Site 对象)、$user(WP_User 对象)
  • 内容格式:需适配 wp_mail() 传输要求
  • 引入版本:WordPress 5.6.0

代码示例

$new_site_email = apply_filters( 'new_site_email', $new_site_email, $site, $user );

注意事项

  • 邮件内容应遵循 wp_mail() 的格式规范,以确保正确发送
  • 此过滤器与 wpmu_new_site_admin_notification() 函数关联,用于通知网络管理员新站点的创建

📄 原文内容

Filters the content of the email sent to the Multisite network administrator when a new site is created.

Description

Content should be formatted for transmission via wp_mail() .

Parameters

$new_site_emailarray
Used to build wp_mail() .

  • to string
    The email address of the recipient.
  • subject string
    The subject of the email.
  • message string
    The content of the email.
  • headers string
    Headers.

$siteWP_Site
Site object of the new site.
$userWP_User
User object of the administrator of the new site.

Source

$new_site_email = apply_filters( 'new_site_email', $new_site_email, $site, $user );

Changelog

Version Description
5.6.0 Introduced.