0

I have a WordPress Network setup with subdomains and am having trouble with the logins. I thought at first it was an issue with a custom plugin I'm developing, but the problem persists even after disabling it (and all plugins, custom themes).

I have the WP login form on a site page (site3.example.com/testing) - users need to be logged in to access the testing page. They can log in through wp-admin, but I don't want them accessing the admin so they're redirected to the testing page anyways. The issue is, after submitting the signup form they're simply sent back to the same page not logged in. No error message are created and I've verified the login credential are correct.

I think the issue stems originally from my plugin. It uses user credentials all from site2.example.com - the idea was to keep all the plugin content in one WP site and extend a restricted portion to site3. To get the logins to work this way, I set define('COOKIE_DOMAIN', false); in wp-config.php - is that advisable? Now even with the plugin disabled, the cookie or history is possibly conflicting with the login?

Also of note; My main site is on primary.ezample.com and my sub sites are site2.ezmaple.com etc. Not the default {subdomain}.{primary domain} structure. This is because my example.come site is not in WordPress so WP needed to not override it. (I did this by manually updating the wp_blogs links in the database - works well enough unless it's the probable cause of this bizarre issue)

Logins for admins and other roles work fine on each other WP Network site, just not the trainers since they are redirected to site3.

Interestingly, everything works fine in a clear history, empty cache browser. Ctrl+F5 hard refresh doesn't do it, it needs to be an entirely new browser session. Naturally, not all of my users want to do that, so I'm looking for possible ways to program a fix in the site itself.

1

It seems it is a Cookies issue. Setting define('COOKIE_DOMAIN', ''); and define('COOKIE_DOMAIN', false); seems to work fine, but users had old cookies stored as well - so WordPress was seeing multiple login credentials in the cookies and redirecting to wp-login.php?reauth=1, forcing a new login.

I'm trying to re-set the cookies to expire for them, but since it's a slightly different domain string I'm not able to? Not sure why..

So the solution seems to be, get users to clear their local cookies. Now I'm also using a maybe more clearly documented define('COOKIE_DOMAIN', '.example.com');.

0

Strangely it worked for me (on more than one multisites) to set SUBDOMAIN_INSTALL to false. To be honest, I hadn't had time to investigate further why ...

define('SUBDOMAIN_INSTALL', false);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.