extend wordpress session into main domain

I have a site that uses wordpress for community purposes, it is installed under subdirectory “mysite/community” but when I try to call wordpress functions into “mysite” I cannot retrieve the logged user.

Here’s my 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";
}

Related posts

Leave a Reply

2 comments