Filter hook 'auth_cookie'

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

View Source

auth_cookie

Filter Hook
Description
Filters the authentication cookie.

Hook Information

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

Hook Parameters

Type Name Description
string $cookie Authentication cookie.
int $user_id User ID.
int $expiration The time the cookie expires as a UNIX timestamp.
string $scheme Cookie scheme used. Accepts 'auth', 'secure_auth', or 'logged_in'.
string $token User's session token used.

Usage Examples

Basic Usage
<?php
// Hook into auth_cookie
add_filter('auth_cookie', 'my_custom_filter', 10, 5);

function my_custom_filter($cookie, $user_id, $expiration, $scheme, $token) {
    // Your custom filtering logic here
    return $cookie;
}

Source Code Context

wp-includes/pluggable.php:905 - How this hook is used in WordPress core
<?php
 900  		 * @param int    $user_id    User ID.
 901  		 * @param int    $expiration The time the cookie expires as a UNIX timestamp.
 902  		 * @param string $scheme     Cookie scheme used. Accepts 'auth', 'secure_auth', or 'logged_in'.
 903  		 * @param string $token      User's session token used.
 904  		 */
 905  		return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme, $token );
 906  	}
 907  endif;
 908  
 909  if ( ! function_exists( 'wp_parse_auth_cookie' ) ) :
 910  	/**

PHP Documentation

<?php
/**
		 * Filters the authentication cookie.
		 *
		 * @since 2.5.0
		 * @since 4.0.0 The `$token` parameter was added.
		 *
		 * @param string $cookie     Authentication cookie.
		 * @param int    $user_id    User ID.
		 * @param int    $expiration The time the cookie expires as a UNIX timestamp.
		 * @param string $scheme     Cookie scheme used. Accepts 'auth', 'secure_auth', or 'logged_in'.
		 * @param string $token      User's session token used.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 5
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.