auth_cookie_valid action-hookWP 2.7.0

Fires once an authentication cookie has been validated.

Usage

add_action( 'auth_cookie_valid', 'wp_kama_auth_cookie_valid_action', 10, 2 );

/**
 * Function for `auth_cookie_valid` action-hook.
 * 
 * @param string[] $cookie_elements Authentication cookie components.
 * @param WP_User  $user            User object.
 *
 * @return void
 */
function wp_kama_auth_cookie_valid_action( $cookie_elements, $user ){

	// action...
}
$cookie_elements(string[])

Authentication cookie components.

  • username(string)
    User's username.

  • expiration(string)
    The time the cookie expires as a UNIX timestamp.

  • token(string)
    User's session token used.

  • hmac(string)
    The security hash for the cookie.

  • scheme(string)
    The cookie scheme to use.
$user(WP_User)
User object.

Changelog

Since 2.7.0 Introduced.

Where the hook is called

wp_validate_auth_cookie()
auth_cookie_valid
wp-includes/pluggable.php 837
do_action( 'auth_cookie_valid', $cookie_elements, $user );

Where the hook is used in WordPress

wp-includes/default-filters.php 326
add_action( 'auth_cookie_valid', 'rest_cookie_collect_status' );