wp_login

Fires after the user has successfully logged in.

Description

do_action( 'wp_login', (string) $user_login_name, (unknown) $get_userdata ); 

Parameters (2)

0. $user_login_name (string)
The user login name.
1. $get_userdata (unknown) => get_userdata($user_login_id)
The get userdata.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'wp_login', $user_login_name, $get_userdata ); 
The following example is for adding a hook callback.
  1. // define the wp_login callback 
  2. function action_wp_login( $user_login_name, $get_userdata ) { 
  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).

/_process_login.php  
  1. do_action('wp_login', $user_login_name, get_userdata($user_login_id));