auth_cookie

Filters the authentication cookie.

Description

apply_filters( 'auth_cookie', (string) $cookie, (int) $user_id, (int) $expiration, (string) $scheme, (string) $token ); 

Parameters (5)

0. $cookie (string)
Authentication cookie.
1. $user_id (int)
The user id.
2. $expiration (int)
The time the cookie expires as a UNIX timestamp.
3. $scheme (string)
Cookie scheme used. Accepts auth,, secure_auth., or logged_in.
4. $token (string)
User's session token used.

Usage

To run the hook, copy the example below.
  1. $cookie = apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme, $token ); 
  2.  
  3. if ( !empty( $cookie ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the auth_cookie callback 
  2. function filter_auth_cookie( $cookie, $user_id, $expiration, $scheme, $token ) { 
  3. // make filter magic happen here... 
  4. return $cookie
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'auth_cookie', 'filter_auth_cookie', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'auth_cookie', 'filter_auth_cookie', 10, 5 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/pluggable.php  
  1. return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme, $token );