Issues with remaining logged in when I switch to domain mapped site

I installed Domain Mapping and mapped a few domains to my subsites. All settings appear as being correct both in the network admin and on the subsites, but when I try to access the mapped domain directly on the browser while being logged in on the main site, I’m automatically logged out. When I am redirected to the mapped domain I am no longer logged in.

  • Adam Czajczyk

    Hello dwhitlock

    I hope you're well today and thank you for your question!

    Since it's not possible to run any more complex tests on the site (e.g. plugin conflict test) and I can't make any changes to the configuration, we'll need to go through this in more of a "step by step" manner, I hope that's fine.

    I checked your setup (didn't make any changes, only took a look) and I have noticed two things worth testing in a first place:

    1. Go to the Network Admin -> Settings -> Domain Mapping and you'll find a Cross-Domain Autologin option there which is enabled (and it should be); please double-check if the same issue happens if you disable the "Load cross-domain autologin asynchronously" option; On some setups that helps "speed up" cross-domain autologin but there were cases where it actually caused issues so please test it and let me know.

    2. You have already asked about login cookies during the chat. That's a valid question and I see that you got a Cookie Domain set on your setup to the main domain of your site. This means that WP is "forced" to use login cookies in the domain only which might interfere with the mapped domains. For mapped domains that shouldn't be set so please access your site via FTP or cPanel "File Manager" and edit the "wp-config.php" file:

    look for this line there

    define('COOKIE_DOMAIN', '');

    and either comment it out like this:

    /* define('COOKIE_DOMAIN', ''); */

    or replace with "empty" one

    define('COOKIE_DOMAIN', '');

    or remove entirely. After that clear all caches (site and browser and server if there is any) and check if the issue still happens.

    Also, is there any reason why you keep the version of Domain Mapping, not upgrading it to the most recent version?

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.