check_password
Filters whether the plaintext password matches the hashed password.
Usage
add_filter( 'check_password', 'wp_kama_check_password_filter', 10, 4 );
/**
* Function for `check_password` filter-hook.
*
* @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.
*
* @return bool
*/
function wp_kama_check_password_filter( $check, $password, $hash, $user_id ){
// filter...
return $check;
}
- $check(true|false)
- Whether the passwords match.
- $password(string)
- The plaintext password.
- $hash(string)
- The hashed password.
- $user_id(string|int)
- Optional ID of a user associated with the password. Can be empty.
Changelog
| Since 2.5.0 | Introduced. |
| Since 6.8.0 | Passwords are now hashed with bcrypt by default. Old passwords may still be hashed with phpass or md5. |
Where the hook is called
check_password
wp-includes/pluggable.php 2882
return apply_filters( 'check_password', $check, $password, $hash, $user_id );