Multi site root site installed on subdomain, with child sites as subdirectories

It’s likely because your authentication cookie is set to dev.example.com/site1/ when you login to site1, and naturally the browser won’t pass that cookie for site2.

What you can try and do is play around with the SITECOOKIEPATH and ADMIN_COOKIE_PATH, which by default are set as follows:

  • SITECOOKIEPATH to get_option('siteurl')
  • ADMIN_COOKIE_PATH as SITECOOKIEPATH . 'wp-admin'

So changing the SITECOOKIEPATH through your wp-config.php file to something that will be shared between both sites should work, for example /. I’m not sure what will happen to the ADMIN_COOKIE_PATH at that point but my guess is that the default value will not work anymore, since your wp-admin directories are in different locations. I don’t think you can set ADMIN_COOKIE_PATH in a plugin because the default gets set quite early, so I guess you’ll have to use sunrise.php if you want to set it to something like get_option('siteurl') . 'wp-admin'.