Action hook 'wp_login'

in WP Core File wp-includes/user.php at line 138

View Source

wp_login

Action Hook
Description
Fires after the user has successfully logged in.

Hook Information

File Location wp-includes/user.php View on GitHub
Hook Type Action
Line Number 138

Hook Parameters

Type Name Description
string $user_login Username.
WP_User $user WP_User object of the logged-in user.

Usage Examples

Basic Usage
<?php
// Hook into wp_login
add_action('wp_login', 'my_custom_function', 10, 2);

function my_custom_function($user_login, $user) {
    // Your custom code here
}

Source Code Context

wp-includes/user.php:138 - How this hook is used in WordPress core
<?php
 133  	 * @since 1.5.0
 134  	 *
 135  	 * @param string  $user_login Username.
 136  	 * @param WP_User $user       WP_User object of the logged-in user.
 137  	 */
 138  	do_action( 'wp_login', $user->user_login, $user );
 139  
 140  	return $user;
 141  }
 142  
 143  /**

PHP Documentation

<?php
/**
	 * Fires after the user has successfully logged in.
	 *
	 * @since 1.5.0
	 *
	 * @param string  $user_login Username.
	 * @param WP_User $user       WP_User object of the logged-in user.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.