钩子文档

newuser_notify_siteadmin

💡 云策文档标注

概述

newuser_notify_siteadmin 是一个 WordPress 过滤器钩子,用于修改发送给网络管理员的新用户激活电子邮件的消息正文。它允许开发者自定义邮件内容,基于新用户的 WP_User 实例。

关键要点

  • 过滤器钩子:newuser_notify_siteadmin,用于过滤新用户激活邮件的正文。
  • 参数:接受两个参数:$msg(字符串,邮件正文)和 $user(WP_User 实例,代表新用户)。
  • 用途:主要用于多站点网络环境,通知网络管理员新用户已激活。
  • 来源:定义在 wp-includes/ms-functions.php 文件中。
  • 版本历史:自 WordPress MU 3.0.0 版本引入。

代码示例

$msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user );

📄 原文内容

Filters the message body of the new user activation email sent to the network administrator.

Parameters

$msgstring
Email body.
$userWP_User
WP_User instance of the new user.

Source

$msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user );

Changelog

Version Description
MU (3.0.0) Introduced.