I'd like to add a new user to the WordPress user table. The code for wp_create_user works fine but it is adding the user incrementally to the next available ID in the user table.
Instead, I want to create the user and assign it to a particular user ID. The user ID is already available (externally) and I want the ID entered into the WordPress database to match the external one.
$user_login = $username ; $pas1 = $email_address; $user_email = $email_address; wp_create_user( $user_login, $pas1, $user_email ); $user = new WP_User($user_id); $user->set_role('editor');
For example, I want to know how to set the known $user_id at the time of wp_create_user.