WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/wp validate auth cookie

Contents

Description

Validates authentication cookie.

The checks include making sure that the authentication cookie is set and pulling in the contents (if $cookie is not used). Makes sure the cookie is not expired. Verifies the hash in cookie is what is should be and compares the two.

Parameters

$cookie
(string) (optional) Optional. If used, will validate contents instead of cookie's
Default:
$scheme
(string) (optional) Optional. The cookie scheme to use: auth, secure_auth, or logged_in
Default:

Return Values

false (bool) 
False if invalid cookie
User ID (int) 
User ID on success

Change Log

Since: 2.5

Source File

wp_validate_auth_cookie() is located in wp-includes/pluggable.php