Validates the logged-in cookie.
Checks the logged-in cookie if the previous auth cookie could not be validated and parsed.
This is a callback for the ‘determine_current_user’ filter, rather than API.
$user_idint|falserequired
determine_current_user filter.function wp_validate_logged_in_cookie( $user_id ) {
if ( $user_id ) {
return $user_id;
}
if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
return false;
}
return wp_validate_auth_cookie( $_COOKIE[ LOGGED_IN_COOKIE ], 'logged_in' );
}
| Version | Description |
|---|---|
| 3.9.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_validate_logged_in_cookie