I’m trying to get the login data from outside of wordpress.
I mean, I have wordpress installed in mysite/wp/
and I’m calling the following functions in mysite/index.php
include( 'wp/wp-load.php');
global $current_user;
get_currentuserinfo();
print_r($current_user);
which prints an empty WP_User Object like this:
WP_User Object ( [data] => [ID] => 0 [caps] => Array ( ) [cap_key] => [roles] => Array ( ) [allcaps] => Array ( ) [filter] => )
Should I include something else? What am I doing wrong?
Thanks..
I solved my problem, and it could definitely help others too.
The problem was with my folder structure,
since it was like
the cookies were only valid for wordpress folder, and it’s subdirectories.
In order to activate the cookies outside wordpress, I installed the root Cookie plugin, and everything works fine now.
P.S.
Do NOT change the configuration of root Cookie. Just leave the Domain Name setting as empty.