I guess WP uses a PHP session (or a cookie) to save login data, right?
I have a website, which uses WP as a CMS, but display (and create) content from outside. I allow anonymous posts, by simply not passing
However, I also want to make users (that are registered in WP) to be able to login in
mysite/wp/wp-login.php, than redirect to
mysite/mypage.php, and get the
user id from session or cookie.
How do I do that?
include( 'wp/wp-load.php'); global $current_user; get_currentuserinfo(); print_r($current_user);
this prints an empty WP_User Object:
WP_User Object ( [data] => [ID] => 0 [caps] => Array ( ) [cap_key] => [roles] => Array ( ) [allcaps] => Array ( ) [filter] => )
Although I'm logged in in WP.
Now that I saw
wp-login-form in tags, which gave me a better idea.
Can I put a login form to my page (outside wp) ? This would surely be better, since it wouldn't require the users to redirect.
I want minimum (ideally zero) interaction between
mysite/wp and visitors (including Google Bot).