set_auth_cookie
Action HookDescription
Fires immediately before the authentication cookie is set.Hook Information
File Location |
wp-includes/pluggable.php
View on GitHub
|
Hook Type | Action |
Line Number | 1069 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$auth_cookie
|
Authentication cookie value. |
int
|
$expire
|
The time the login grace period expires as a UNIX timestamp. Default is 12 hours past the cookie's expiration time. |
int
|
$expiration
|
The time when the authentication cookie expires as a UNIX timestamp. Default is 14 days from now. |
int
|
$user_id
|
User ID. |
string
|
$scheme
|
Authentication scheme. Values include 'auth' or 'secure_auth'. |
string
|
$token
|
User's session token to use for this cookie. |
Usage Examples
Basic Usage
<?php
// Hook into set_auth_cookie
add_action('set_auth_cookie', 'my_custom_function', 10, 6);
function my_custom_function($auth_cookie, $expire, $expiration, $user_id, $scheme, $token) {
// Your custom code here
}
Source Code Context
wp-includes/pluggable.php:1069
- How this hook is used in WordPress core
<?php
1064 * Default is 14 days from now.
1065 * @param int $user_id User ID.
1066 * @param string $scheme Authentication scheme. Values include 'auth' or 'secure_auth'.
1067 * @param string $token User's session token to use for this cookie.
1068 */
1069 do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme, $token );
1070
1071 /**
1072 * Fires immediately before the logged-in authentication cookie is set.
1073 *
1074 * @since 2.6.0
PHP Documentation
<?php
/**
* Fires immediately before the authentication cookie is set.
*
* @since 2.5.0
* @since 4.9.0 The `$token` parameter was added.
*
* @param string $auth_cookie Authentication cookie value.
* @param int $expire The time the login grace period expires as a UNIX timestamp.
* Default is 12 hours past the cookie's expiration time.
* @param int $expiration The time when the authentication cookie expires as a UNIX timestamp.
* Default is 14 days from now.
* @param int $user_id User ID.
* @param string $scheme Authentication scheme. Values include 'auth' or 'secure_auth'.
* @param string $token User's session token to use for this cookie.
*/
Quick Info
- Hook Type: Action
- Parameters: 6
- File: wp-includes/pluggable.php
Related Hooks
Related hooks will be displayed here in future updates.