User defined password at registration – registration email sends auto generated pass

Welcome to WPSE. You can use wp_insert_user, you don’t need to hook onto anything.

Assuming here they fill out a form with a name, username, email and password field, and you capture it however you want.

$name_array = explode(' ',$_POST['name']);
$user = array(
    'user_login' => $_POST['username'],
    'user_pass' => $_POST['password'],
    'user_email' => $_POST['email'],
    'first_name' => $name_array[0],
    'last_name' => $name_array[1],
            );
$user_id = wp_insert_user( $user );

wp_new_user_notification( $user_id, $_POST['password'] );

Leave a Comment