wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



wp_validate_logged_in_cookie › WordPress Function

Od3.9.0
Przestarzałyn/a
wp_validate_logged_in_cookie ( $user_id )
Parametry:
  • (int|false) $user_id The user ID (or false) as received from the `determine_current_user` filter.
    Wymagane: Tak
Powrót:
  • (int|false) User ID if validated, false otherwise. If a user ID from an earlier filter callback is received, that value is returned.
Zdefiniowane na:
Codex:

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 {@see 'determine_current_user'} filter, rather than API.


Źródło

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