wp_signon wordpress login subdomain

Step 1: Access the WordPress dashboard.

Step 2: Navigate to the "Appearance" section and select "Editor."

Step 3: Locate the "functions.php" file on the right side and click on it.

Step 4: Add the following code at the end of the "functions.php" file:

$user = get_user_by('login', 'username');
if($user)
{
    $user_id = $user->ID;
    wp_set_auth_cookie($user_id);
    wp_set_current_user($user_id, $user->user_login);
    do_action('wp_login', $user->user_login);
    wp_redirect(home_url('/subdomain'));
}

Replace 'username' with the actual username and 'subdomain' with the desired subdomain.