Email notification after registration in WordPress

I would like the site’s administrator doesn’t receive a new user’s registration email when the administrator himself uses the admin interface to add a user.

How can I limit sending a email only when a user completes the registration form ?

// If the registration form was completed by a user ...

add_action( 'user_register', 'user_registration_save', 10, 1 );
function user_registration_save( $user_id ) {
   $to = '';
   $subject="New register with the form";
   $message .= "Identifiant : " . $user->user_login . "\r\n\r\n";
   $message .= "E-mail : " . $user->user_email;
   wp_mail( $to, $subject, $message );
}

0

Leave a Comment