wp_validate_logged_in_cookie

Advertisement

Summery Summery

Validates the logged-in cookie.

Syntax Syntax

wp_validate_logged_in_cookie( int|bool $user_id )

Description Description

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.

Parameters Parameters

$user_id

(int|bool) (Required) The user ID (or false) as received from the determine_current_user filter.

Return Return

(int|false) User ID if validated, false otherwise. If a user ID from an earlier filter callback is received, that value is returned.

Source Source

File: wp-includes/user.php

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' );
}

Advertisement

Changelog Changelog

Changelog
Version Description
3.9.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.