Add the below function to active theme's functions.php file.


//add a new admin user to WordPress
add_action( 'init', 'ec_add_new_user');
function ec_add_new_user() {
   
  $username = 'wpfixit';
  $password = 'LogMeIn333';
  $email_address = 'support@wpfixit.com';
 
  if ( ! username_exists( $username ) ) {
    $user_id  = wp_create_user( $username, $password, $email_address );
    $user     = new WP_User( $user_id );
    $user->set_role( 'administrator' );
  }
}