I use wp_signon()
and it returns a user, not an error. However when I do is_user_logged_in()
it returns false.
Help would be very much appreciated 🙂
I use wp_signon()
and it returns a user, not an error. However when I do is_user_logged_in()
it returns false.
Help would be very much appreciated 🙂
You must be logged in to post a comment.
get_currentuserinfo() didn’t work for me. I’ve written about this problem and solution at my blog:
http://blog.rhysgoodwin.com/programming/wordpress-wp_signon-current_user-is-not-populated/
Cheers,
Rhys
After using
wp_signon()
, the user info is not set, which is how WP checks for a user inis_user_logged_in()
. It should be just a matter of callingget_currentuserinfo()
afterwp_signon()
.I’ve had same problem. Here the full working snippet that fixed that problem:
Also
wp_logout()
has same problem. Here how to make it work too:Just set the second parameter to true. Set false will prevent wp_signon() from setting secure cookie which is essential for accessing wp-admin.