check_password

Filters whether the plaintext password matches the encrypted password.

Description

apply_filters( 'check_password', (bool) $check, (string) $password, (string) $hash, (string|int) $user_id ); 

Parameters (4)

0. $check (bool)
Whether the passwords match.
1. $password (string)
The plaintext password.
2. $hash (string)
The hashed password.
3. $user_id (string|int)
User ID. Can be empty.

Usage

To run the hook, copy the example below.
  1. $check = apply_filters( 'check_password', $check, $password, $hash, $user_id ); 
  2.  
  3. if ( !empty( $check ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the check_password callback 
  2. function filter_check_password( $check, $password, $hash, $user_id ) { 
  3. // make filter magic happen here... 
  4. return $check
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'check_password', 'filter_check_password', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'check_password', 'filter_check_password', 10, 4 ); 

Defined (2)

The filter is defined in the following location(s).

/wp-includes/pluggable.php  
  1. return apply_filters( 'check_password', $check, $password, $hash, $user_id ); 
  1. return apply_filters( 'check_password', $check, $password, $hash, $user_id );