How to make Multisite global login that redirects to correct subsite after login

I just tested this on my local with a fresh subdmoain setup. Here’s my setup:

  • Created subdomain.test
  • Added site: demo1.subdomain.test with the admin user demo1
  • Added site: demo2.subdomain.test with the admin user demo2

Now, if I go to http://subdomain.test/wp-login.php and login, I get the following results:

In short, WordPress already does this for you, assuming that the admin users for your subdomains are only admins for those sites.