Checks a plaintext application password against a hashed password.
Parameters
$password
stringrequired- Plaintext password.
$hash
stringrequired- Hash of the password to check against.
Source
public static function check_password(
#[\SensitiveParameter]
string $password,
string $hash
): bool {
if ( ! str_starts_with( $hash, '$generic$' ) ) {
/*
* If the hash doesn't start with `$generic$`, it is a hash created with `wp_hash_password()`.
* This is the case for application passwords created before 6.8.0.
*/
return wp_check_password( $password, $hash );
}
return wp_verify_fast_hash( $password, $hash );
}
Changelog
Version | Description |
---|---|
6.8.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.