–> Create an admin user programmatically in WordPress
add_action('init', 'add_user');
function add_user(){
function add_user(){
$username = 'username123';
$password = 'pasword123';
$email = '[email protected]';
$user_id = wp_create_user($username, $password, $email);
$user = get_user_by('id', $user_id);
$user->remove_role('subscriber');
$user->add_role('administrator');
}