auth_cookie_expiration
Filters the duration of the authentication cookie expiration period.
Usage
add_filter( 'auth_cookie_expiration', 'wp_kama_auth_cookie_expiration_filter', 10, 3 );
/**
* Function for `auth_cookie_expiration` filter-hook.
*
* @param int $length Duration of the expiration period in seconds.
* @param int $user_id User ID.
* @param bool $remember Whether to remember the user login.
*
* @return int
*/
function wp_kama_auth_cookie_expiration_filter( $length, $user_id, $remember ){
// filter...
return $length;
}
- $length(int)
- Duration of the expiration period in seconds.
- $user_id(int)
- User ID.
- $remember(true|false)
- Whether to remember the user login.
Default: false
Changelog
| Since 2.8.0 | Introduced. |
Where the hook is called
auth_cookie_expiration
auth_cookie_expiration
wp-includes/pluggable.php 1082
$expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember );
wp-includes/user.php 2930
$default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $user_id, false );
wp-includes/pluggable.php 1091
$expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember );