From 42801d889673a6f5e736a39b2a5766aafc0be110 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sun, 25 Jun 2017 20:07:08 +0000 Subject: [PATCH] Docs: Add a note to the DocBlock for `wp_signon()` mentioning that it doesn't handle setting the current user. Also outlines the conditions that must be met for is_user_logged_in() to work with it. Part props SergeyBiryukov. Fixes #28116. git-svn-id: https://develop.svn.wordpress.org/trunk@40943 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/user.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index 2bb4e0543e..e276551628 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -17,6 +17,11 @@ * set for a longer period depending on if the 'remember' credential is set to * true. * + * Note: wp_signon() doesn't handle setting the current user. This means that if the + * function is called before the {@see 'init'} hook is fired, is_user_logged_in() will + * evaluate as false until that point. If is_user_logged_in() is needed in conjunction + * with wp_signon(), wp_set_current_user() should be called explicitly. + * * @since 2.5.0 * * @global string $auth_secure_cookie