Hi @trumor,
Thanks for the report.
Unfortunately, if the sites are on different domains, it won’t be possible to pass session data from one request to another. PHP session data is tied to the visitor with a domain-based cookie.
What you might consider instead is including a query parameter (e.g. ?redirected=true
) in the initial redirect, and using the presence of the query parameter to set a session on the target site.
Hope this helps!
Thread Starter
trumor
(@trumor)
Hi Daniel,
I’m using a subdirectory multisite so the domain name is the same. I think my problem across the multisite network is the cookie domain. I’ve tried this for my cookie domain settings.
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', false);
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');
I’ve also tried it with define(‘COOKIE_DOMAIN’, ”). If I understand the cookie domain settings correctly this should make all of the network sites use the same cookie.
Also the session variables don’t seem to persist across pages. I have session_start() at the beginning of the init action but $_SESSION is always empty.
I’m on WP Engine which I understand is very aggressive at caching. And I think that trying to use sessions the way I am would probably defeat the purpose of the cache. So I may need to find a different solution.
Thanks.