php - extend wordpress session into main domain -
i have site uses wordpress community purposes, installed under subdirectory "mysite/community" when try call wordpress functions "mysite" cannot retrieve logged user.
here's sample code:
require $xcart_dir . dir_community . '/wp-load.php'; wp_get_current_user(); if ( 0 == $current_user->id ) { echo "not logged in"; } else { echo "logged in"; }
cookies can contain path, looking for: http://codex.wordpress.org/editing_wp-config.php#additional_defined_constants
to allow cookie path on domain, use define('cookiepath',"/");
.
you can set cookie domain in wp-config.php: http://codex.wordpress.org/editing_wp-config.php#set_cookie_domain
use ".example.com"
allow cookie subdomains of example.com.
Comments
Post a Comment