ncrocfer
ncrocfer

Reputation: 2570

Using same cookies with differents subdomains in Wordpress

I have my main domain (http://www.domain.com) which is under Wordpress, and I created subdomains that link categories :

It works very well except for the persistent of cookies... I can not use functions such as get_currentuserinfo() or global variables such as $user_ID.

I tried this but it did not work :

define('COOKIEPATH', '/');
define('COOKIE_DOMAIN', '.domain.com');

Have you got any ideas please ? Thank you.

Upvotes: 0

Views: 2305

Answers (1)

Louis Huppenbauer
Louis Huppenbauer

Reputation: 3714

The wordpress.org site mentions different cookiepath constants, namely

define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
define('PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );

Have you tried those already? (You'd have to set your corresponding paths of course ;))

Source: Here

Upvotes: 1

Related Questions