auth_cookie_expiration filter-hookWP 2.8.0

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

wp_set_auth_cookie()
auth_cookie_expiration
wp_update_user()
auth_cookie_expiration
wp-includes/pluggable.php 981
$expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember );
wp-includes/pluggable.php 990
$expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember );
wp-includes/user.php 2698
$default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $user_id, false );

Where the hook is used in WordPress

Usage not found.