0

I have some issues with this method:

    funtion AddUser($data){
    $WP_array = array(
        'user_login'            =>  "info here",
        'user_email'            =>  "info here",
        'user_pass'             =>  "info here",
        'first_name'            =>  "info here",
        'last_name'             =>  "info here",
        'role'                  =>  "info here",
        'show_admin_bar_front'  =>  "info here",
    ) ;
    $user_id = wp_insert_user($WP_array);
}

After adding the new user,wordpress automatically sends an empty email D: so what can I do to prevent that, I actually used on my functions.php

add_action( 'init', function() {
    remove_action( 'register_new_user', 'wp_send_new_user_notifications' );
});

Do you have any clue ?

Thank you in advance

2
  • The empty email goes to the user or admin?
    – mozboz
    Commented Aug 14, 2020 at 7:37
  • it goes to the user :( Commented Aug 15, 2020 at 5:35

1 Answer 1

0

I think this needs to live inside a plugin and not in functions.php How to turn off email you receive when registered?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.