Filter hook 'password_needs_rehash'

in WP Core File wp-includes/pluggable.php at line 2837

View Source

password_needs_rehash

Filter Hook
Description
Filters whether the password hash needs to be rehashed.

Hook Information

File Location wp-includes/pluggable.php View on GitHub
Hook Type Filter
Line Number 2837

Hook Parameters

Type Name Description
bool $needs_rehash Whether the password hash needs to be rehashed.
string $hash The password hash.
string|int $user_id Optional. ID of a user associated with the password.

Usage Examples

Basic Usage
<?php
// Hook into password_needs_rehash
add_filter('password_needs_rehash', 'my_custom_filter', 10, 3);

function my_custom_filter($needs_rehash, $hash, $user_id) {
    // Your custom filtering logic here
    return $needs_rehash;
}

Source Code Context

wp-includes/pluggable.php:2837 - How this hook is used in WordPress core
<?php
2832  		 *
2833  		 * @param bool       $needs_rehash Whether the password hash needs to be rehashed.
2834  		 * @param string     $hash         The password hash.
2835  		 * @param string|int $user_id      Optional. ID of a user associated with the password.
2836  		 */
2837  		return apply_filters( 'password_needs_rehash', $needs_rehash, $hash, $user_id );
2838  	}
2839  endif;
2840  
2841  if ( ! function_exists( 'wp_generate_password' ) ) :
2842  	/**

PHP Documentation

<?php
/**
		 * Filters whether the password hash needs to be rehashed.
		 *
		 * @since 6.8.0
		 *
		 * @param bool       $needs_rehash Whether the password hash needs to be rehashed.
		 * @param string     $hash         The password hash.
		 * @param string|int $user_id      Optional. ID of a user associated with the password.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.