Action hook 'wp_login_failed'

in WP Core File wp-includes/pluggable.php at line 648

View Source

wp_login_failed

Action Hook
Description
Fires after a user login has failed.

Hook Information

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

Hook Parameters

Type Name Description
string $username Username or email address.
WP_Error $error A WP_Error object with the authentication failure details.

Usage Examples

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

function my_custom_function($username, $error) {
    // Your custom code here
}

Source Code Context

wp-includes/pluggable.php:648 - How this hook is used in WordPress core
<?php
 643  			 * @since 5.4.0 The `$error` parameter was added.
 644  			 *
 645  			 * @param string   $username Username or email address.
 646  			 * @param WP_Error $error    A WP_Error object with the authentication failure details.
 647  			 */
 648  			do_action( 'wp_login_failed', $username, $error );
 649  		}
 650  
 651  		return $user;
 652  	}
 653  endif;

PHP Documentation

<?php
/**
			 * Fires after a user login has failed.
			 *
			 * @since 2.5.0
			 * @since 4.5.0 The value of `$username` can now be an email address.
			 * @since 5.4.0 The `$error` parameter was added.
			 *
			 * @param string   $username Username or email address.
			 * @param WP_Error $error    A WP_Error object with the authentication failure details.
			 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.