wp_login

Fires after the user has successfully logged in.

Description

do_action( 'wp_login', (string) $user_user_login, (WP_User) $user ); 

Parameters (2)

0. $user_user_login (string)
The user user login.
1. $user (WP_User)
WP_User object of the logged-in user.

Usage

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

Defined (1)

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

/wp-includes/user.php  
  1. do_action( 'wp_login', $user->user_login, $user );