wpmu_welcome_notification
云策文档标注
概述
wpmu_welcome_notification 是一个 WordPress 过滤器,用于控制是否在站点激活后向站点管理员发送欢迎邮件。返回 false 可以禁用该邮件。
关键要点
- 这是一个过滤器,允许开发者自定义是否发送站点激活后的欢迎邮件。
- 返回 false 会阻止邮件发送,可用于禁用或基于条件跳过邮件。
- 过滤器接收参数包括站点 ID、用户 ID、密码、站点标题和注册元数据,便于进行条件判断。
- 主要用于多站点环境,与 wpmu_welcome_notification() 函数相关。
代码示例
if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) ) {
// 邮件发送被阻止的逻辑
}注意事项
- 该过滤器自 WordPress MU 3.0.0 版本引入,适用于多站点安装。
- 参数 $password 可能为 "N/A",表示用户账户不是新创建的。
- 使用时应确保正确处理所有参数,以避免意外行为。
原文内容
Filters whether to bypass the welcome email sent to the site administrator after site activation.
Description
Returning false disables the welcome email.
Parameters
$blog_idint|false-
Site ID, or false to prevent the email from sending.
$user_idint-
User ID of the site administrator.
$passwordstring-
User password, or “N/A” if the user account is not new.
$titlestring-
Site title.
$metaarray-
Signup meta data. By default, contains the requested privacy setting and lang_id.
Source
if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) ) {
Changelog
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |