create wordpress user programatically
function my_create_user() {
$user = '*** username ***';
$pass = '*** password ***';
$email = '*** [email protected] ***';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' ); // Set user role ('editor', 'customer', 'subscriber', etc) More roles: https://wordpress.org/support/article/roles-and-capabilities/#summary-of-roles
}
}
add_action('init', 'my_create_user');