Creates a recovery mode key.
Parameters
$tokenstringrequired- A token generated by generate_recovery_mode_token().
Source
public function generate_and_store_recovery_mode_key( $token ) {
$key = wp_generate_password( 22, false );
$records = $this->get_keys();
$records[ $token ] = array(
'hashed_key' => wp_fast_hash( $key ),
'created_at' => time(),
);
$this->update_keys( $records );
/**
* Fires when a recovery mode key is generated.
*
* @since 5.2.0
*
* @param string $token The recovery data token.
* @param string $key The recovery mode key.
*/
do_action( 'generate_recovery_mode_key', $token, $key );
return $key;
}
Hooks
- do_action( ‘generate_recovery_mode_key’,
string $token ,string $key ) Fires when a recovery mode key is generated.
Changelog
| Version | Description |
|---|---|
| 6.8.0 | The stored key is now hashed using wp_fast_hash() instead of phpass. |
| 5.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.