Fires immediately before the authentication cookie is set.


do_action( 'set_auth_cookie', (string) $auth_cookie, (int) $expire, (int) $expiration, (int) $user_id, (string) $scheme ); 

Parameters (5)

0. $auth_cookie (string)
Authentication cookie.
1. $expire (int)
The time the login grace period expires as a UNIX timestamp. Default is 12 hours past the cookie's expiration time.
2. $expiration (int)
The time when the authentication cookie expires as a UNIX timestamp. Default is 14 days from now.
3. $user_id (int)
The user id.
4. $scheme (string)
Authentication scheme. Values include auth,, secure_auth., or logged_in.


To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme ); 
The following example is for adding a hook callback.
  1. // define the set_auth_cookie callback 
  2. function action_set_auth_cookie( $auth_cookie, $expire, $expiration, $user_id, $scheme ) { 
  3. // make action magic happen here... 
  4. }; 
  6. // add the action 
  7. add_action( 'set_auth_cookie', 'action_set_auth_cookie', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'set_auth_cookie', 'action_set_auth_cookie', 10, 5 ); 

Defined (1)

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

  1. do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme );