Cookie settings for session across WPML subdomains using custom AJAX login
-
I am trying to enable a custom login session across both English and French subdomains.
-WordPress is installed only on domain.com.
-There are only en.domain.com and fr.domain.com as WPML subdomains, with redirects (as instructed here: https://wpml.org/faq/server-setting-for-languages-in-different-domains/).
-No issues with navigation across subdomains.My AJAX custom login successfully signs in the user with wp_signon(). The AJAX request successfully returns 4 cookies. However, session is not initiated; on page refresh, user is still not connected.
When I login through /wp-login.php, the session is properly initiated.
It seems like the solution lies in the proper configuration of COOKIE_DOMAIN, COOKIEPATH & SITECOOKIEPATH settings:
define('COOKIE_DOMAIN', '.domain.com'); define('COOKIEPATH', '/'); define('SITECOOKIEPATH', '/');
Anyone has a solution for this?
- The topic ‘Cookie settings for session across WPML subdomains using custom AJAX login’ is closed to new replies.