Action hook 'auth_cookie_valid'

in WP Core File wp-includes/pluggable.php at line 848

View Source

auth_cookie_valid

Action Hook
Description
Fires once an authentication cookie has been validated. }

Hook Information

File Location wp-includes/pluggable.php View on GitHub
Hook Type Action
Line Number 848

Hook Parameters

Type Name Description
string[] $cookie_elements { Authentication cookie components.
WP_User $user User object.

Usage Examples

Basic Usage
<?php
// Hook into auth_cookie_valid
add_action('auth_cookie_valid', 'my_custom_function', 10, 2);

function my_custom_function($cookie_elements, $user) {
    // Your custom code here
}

Source Code Context

wp-includes/pluggable.php:848 - How this hook is used in WordPress core
<?php
 843  		 *     @type string $hmac       The security hash for the cookie.
 844  		 *     @type string $scheme     The cookie scheme to use.
 845  		 * }
 846  		 * @param WP_User  $user            User object.
 847  		 */
 848  		do_action( 'auth_cookie_valid', $cookie_elements, $user );
 849  
 850  		return $user->ID;
 851  	}
 852  endif;
 853  

PHP Documentation

<?php
/**
		 * Fires once an authentication cookie has been validated.
		 *
		 * @since 2.7.0
		 *
		 * @param string[] $cookie_elements {
		 *     Authentication cookie components.
		 *
		 *     @type string $username   User's username.
		 *     @type string $expiration The time the cookie expires as a UNIX timestamp.
		 *     @type string $token      User's session token used.
		 *     @type string $hmac       The security hash for the cookie.
		 *     @type string $scheme     The cookie scheme to use.
		 * }
		 * @param WP_User  $user            User object.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.