Skip to main content
added 10 characters in body
Source Link
bueltge
  • 17.1k
  • 7
  • 61
  • 97

I know it is pretty late, but I am adding my answer to help others. If you use wp_signon()wp_signon() function to login, and verify with is_user_logged_in()is_user_logged_in() thereafter, you need to set the current user with wp_set_current_user()wp_set_current_user() first because wp_signon()wp_signon() does not handle setting the current user as described in the wpWP codex:

https://developer.wordpress.org/reference/functions/wp_signon/

This is one of the reasons why the function is_user_logged_in()is_user_logged_in() says false when you thought you have logged in a user already.

I know it is pretty late, but I am adding my answer to help others. If you use wp_signon() function to login, and verify with is_user_logged_in() thereafter, you need to set the current user with wp_set_current_user() first because wp_signon() does not handle setting the current user as described in the wp codex:

https://developer.wordpress.org/reference/functions/wp_signon/

This is one of the reasons why the function is_user_logged_in() says false when you thought you have logged in a user already.

I know it is pretty late, but I am adding my answer to help others. If you use wp_signon() function to login, and verify with is_user_logged_in() thereafter, you need to set the current user with wp_set_current_user() first because wp_signon() does not handle setting the current user as described in the WP codex:

https://developer.wordpress.org/reference/functions/wp_signon/

This is one of the reasons why the function is_user_logged_in() says false when you thought you have logged in a user already.

Source Link

I know it is pretty late, but I am adding my answer to help others. If you use wp_signon() function to login, and verify with is_user_logged_in() thereafter, you need to set the current user with wp_set_current_user() first because wp_signon() does not handle setting the current user as described in the wp codex:

https://developer.wordpress.org/reference/functions/wp_signon/

This is one of the reasons why the function is_user_logged_in() says false when you thought you have logged in a user already.