check_password
Filter HookDescription
Filters whether the plaintext password matches the hashed password. Old passwords may still be hashed with phpass or md5.Hook Information
File Location |
wp-includes/pluggable.php
View on GitHub
|
Hook Type | Filter |
Line Number | 2779 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$check
|
Whether the passwords match. |
string
|
$password
|
The plaintext password. |
string
|
$hash
|
The hashed password. |
string|int
|
$user_id
|
Optional ID of a user associated with the password. Can be empty. |
Usage Examples
Basic Usage
<?php
// Hook into check_password
add_filter('check_password', 'my_custom_filter', 10, 4);
function my_custom_filter($check, $password, $hash, $user_id) {
// Your custom filtering logic here
return $check;
}
Source Code Context
wp-includes/pluggable.php:2779
- How this hook is used in WordPress core
<?php
2774 * @param string $password The plaintext password.
2775 * @param string $hash The hashed password.
2776 * @param string|int $user_id Optional ID of a user associated with the password.
2777 * Can be empty.
2778 */
2779 return apply_filters( 'check_password', $check, $password, $hash, $user_id );
2780 }
2781 endif;
2782
2783 if ( ! function_exists( 'wp_password_needs_rehash' ) ) :
2784 /**
PHP Documentation
<?php
/**
* Filters whether the plaintext password matches the hashed password.
*
* @since 2.5.0
* @since 6.8.0 Passwords are now hashed with bcrypt by default.
* Old passwords may still be hashed with phpass or md5.
*
* @param bool $check Whether the passwords match.
* @param string $password The plaintext password.
* @param string $hash The hashed password.
* @param string|int $user_id Optional ID of a user associated with the password.
* Can be empty.
*/
Quick Info
- Hook Type: Filter
- Parameters: 4
- File: wp-includes/pluggable.php
Related Hooks
Related hooks will be displayed here in future updates.