钩子文档

wp_send_new_user_notification_to_user

💡 云策文档标注

概述

wp_send_new_user_notification_to_user 是一个 WordPress 过滤器,用于控制是否向新注册用户发送通知邮件。它允许开发者根据条件修改默认的发送行为。

关键要点

  • 这是一个过滤器,用于干预新用户注册后的邮件通知发送逻辑。
  • 接受两个参数:$send(布尔值,默认 true)和 $user(WP_User 对象)。
  • 在 wp_new_user_notification() 函数中被调用,用于向新用户发送登录凭据邮件。
  • 从 WordPress 6.1.0 版本开始引入。

📄 原文内容

Filters whether the user is notified of their new user registration.

Parameters

$sendbool
Whether to send the email. Default true.
$userWP_User
User object for new user.

Source

$send_notification_to_user = apply_filters( 'wp_send_new_user_notification_to_user', true, $user );

Changelog

Version Description
6.1.0 Introduced.