wp_send_new_user_notifications() WordPress Function

The wp_send_new_user_notifications() function is used to notify a site administrator of a new user registration. This function sends an email to the administrator with the new user's username and password.

wp_send_new_user_notifications( int $user_id, string $notify = 'both' ) #

Initiates email notifications related to the creation of new users.


Description

Notifications are sent both to the site admin and to the newly created user.


Top ↑

Parameters

$user_id

(int)(Required)ID of the newly created user.

$notify

(string)(Optional) Type of notification that should happen. Accepts 'admin' or an empty string (admin only), 'user', or 'both' (admin and user).

Default value: 'both'


Top ↑

Source

File: wp-includes/user.php

function wp_send_new_user_notifications( $user_id, $notify = 'both' ) {
	wp_new_user_notification( $user_id, null, $notify );
}


Top ↑

Changelog

Changelog
VersionDescription
4.6.0Converted the $notify parameter to accept 'user' for sending notifications only to the user created.
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More