send_new_site_email
云策文档标注
概述
send_new_site_email 是一个 WordPress 过滤器,用于控制在多站点网络中创建新站点时是否向网络管理员发送电子邮件。开发者可以通过此过滤器自定义邮件发送行为。
关键要点
- 过滤器名称:send_new_site_email
- 用途:控制新站点创建时是否发送邮件给网络管理员
- 参数:$send(布尔值,是否发送邮件)、$site(WP_Site 对象,新站点信息)、$user(WP_User 对象,新站点管理员信息)
- 返回值:返回 false 可禁用邮件发送
- 引入版本:WordPress 5.6.0
代码示例
if ( ! apply_filters( 'send_new_site_email', true, $site, $user ) ) {
// 邮件发送被禁用的处理逻辑
}注意事项
- 此过滤器仅适用于多站点网络环境
- 相关函数:wpmu_new_site_admin_notification() 用于实际发送通知邮件
原文内容
Filters whether to send an email to the Multisite network administrator when a new site is created.
Description
Return false to disable sending the email.
Parameters
Source
if ( ! apply_filters( 'send_new_site_email', true, $site, $user ) ) {
Changelog
| Version | Description |
|---|---|
| 5.6.0 | Introduced. |