Maha Dev
Maha Dev

Reputation: 3965

Wordpress wp_new_user_notification() is not working

I have created page template where I am creating new user and want to send email to new user via this function "wp_new_user_notification()". It's not giving me any response.

Here is my code:

if (null == username_exists($user_email)) {
     include_once (home_url().'/wp-includes/pluggable.php');
     // Generate the password and create the user
     $password = wp_generate_password(12, false);
     $user_id = wp_create_user($user_email, $password, $user_email);

     // Email the user
     wp_new_user_notification($user_id);
 } // end if    

Upvotes: 0

Views: 976

Answers (1)

Kevin S
Kevin S

Reputation: 11

You should use this function like this :

wp_new_user_notification( $user_id,'','user' ); 

Upvotes: 1

Related Questions