Filter hook 'wp_authenticate_user'

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

View Source

wp_authenticate_user

Filter Hook
Description
Authenticates a user using the email and password.

Hook Information

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

Hook Parameters

Type Name Description
WP_User|WP_Error|null $user WP_User or WP_Error object if a previous callback failed authentication.
string $email Email address for authentication.
string $password Password for authentication.

Usage Examples

Basic Usage
<?php
// Hook into wp_authenticate_user
add_filter('wp_authenticate_user', 'my_custom_filter', 10, 3);

function my_custom_filter($user, $email, $password) {
    // Your custom filtering logic here
    return $user;
}

Source Code Context

wp-includes/user.php:285 - How this hook is used in WordPress core
<?php
 280  			__( 'Unknown email address. Check again or try your username.' )
 281  		);
 282  	}
 283  
 284  	/** This filter is documented in wp-includes/user.php */
 285  	$user = apply_filters( 'wp_authenticate_user', $user, $password );
 286  
 287  	if ( is_wp_error( $user ) ) {
 288  		return $user;
 289  	}
 290  

PHP Documentation

<?php
/**
 * Authenticates a user using the email and password.
 *
 * @since 4.5.0
 *
 * @param WP_User|WP_Error|null $user     WP_User or WP_Error object if a previous
 *                                        callback failed authentication.
 * @param string                $email    Email address for authentication.
 * @param string                $password Password for authentication.
 * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.