Action hook 'auth_cookie_bad_username'

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

View Source

auth_cookie_bad_username

Action Hook
Description
Fires if a bad username is entered in the user authentication process. }

Hook Information

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

Hook Parameters

Type Name Description
string[] $cookie_elements { Authentication cookie components. None of the components should be assumed to be valid as they come directly from a client-provided cookie value.

Usage Examples

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

function my_custom_function($cookie_elements) {
    // Your custom code here
}

Source Code Context

wp-includes/pluggable.php:768 - How this hook is used in WordPress core
<?php
 763  			 *     @type string $token      User's session token used.
 764  			 *     @type string $hmac       The security hash for the cookie.
 765  			 *     @type string $scheme     The cookie scheme to use.
 766  			 * }
 767  			 */
 768  			do_action( 'auth_cookie_bad_username', $cookie_elements );
 769  			return false;
 770  		}
 771  
 772  		if ( str_starts_with( $user->user_pass, '$P$' ) || str_starts_with( $user->user_pass, '$2y$' ) ) {
 773  			// Retain previous behaviour of phpass or vanilla bcrypt hashed passwords.

PHP Documentation

<?php
/**
			 * Fires if a bad username is entered in the user authentication process.
			 *
			 * @since 2.7.0
			 *
			 * @param string[] $cookie_elements {
			 *     Authentication cookie components. None of the components should be assumed
			 *     to be valid as they come directly from a client-provided cookie value.
			 *
			 *     @type string $username   User's username.
			 *     @type string $expiration The time the cookie expires as a UNIX timestamp.
			 *     @type string $token      User's session token used.
			 *     @type string $hmac       The security hash for the cookie.
			 *     @type string $scheme     The cookie scheme to use.
			 * }
			 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.