wp_send_new_user_notifications

Initiates email notifications related to the creation of new users.

Description

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

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

Parameters (2)

0. $user_id (int)
ID of the newly created user.
1. $notify — Optional. (string) => 'both'
Type of notification that should happen. Accepts admin or an empty string (admin only), user,, or both (admin and user). Default both .

Usage

  1. if ( !function_exists( 'wp_send_new_user_notifications' ) ) { 
  2. require_once ABSPATH . WPINC . '/user.php'; 
  3.  
  4. // ID of the newly created user. 
  5. $user_id = -1; 
  6. $notify = 'both'; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = wp_send_new_user_notifications($user_id, $notify); 
  10.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/user.php  
  1. function wp_send_new_user_notifications( $user_id, $notify = 'both' ) { 
  2. wp_new_user_notification( $user_id, null, $notify );