wppaste
WordPress

apply_filters( 'wp_hash_password_options', array $options, string $algorithm )

Since
6.8.0, 7.0.0
Filters the options passed to the password_hash() and password_needs_rehash() functions.

Description

The default hashing algorithm is bcrypt, but this can be changed via the 'wp_hash_password_algorithm' filter. You must ensure that the options are appropriate for the algorithm in use.

Compatibility

WordPress
since 7.0.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in 4 of the 5 tracked releases, added in 7.0.0.

Parameters

$optionsarray
Array of options to pass to the password hashing functions.
By default this is an empty array which means the default options will be used.
$algorithmstring
The hashing algorithm in use.

Where this hook fires · 2

  • wp-includes/pluggable.php:2805wp_hash_password()
  • wp-includes/pluggable.php:2922wp_password_needs_rehash()

Source code

		 *		 * @param array  $options   Array of options to pass to the password hashing functions.		 *                          By default this is an empty array which means the default		 *                          options will be used.		 * @param string $algorithm The hashing algorithm in use.		 */		$options = apply_filters( 'wp_hash_password_options', array(), $algorithm ); 		// Algorithms other than bcrypt don't need to use pre-hashing.		if ( PASSWORD_BCRYPT !== $algorithm ) {			return password_hash( $password, $algorithm, $options );		}

Changelog

Introduced in 6.8.0. 2 changes between 6.8.8 and 7.1.0.

  1. 6.8.8
  2. 6.9.7
  3. 7.0.4
  4. 7.1.0

Signature, return type and hooks compared across 4 parsed releases.

7.0.4
Parameter $algorithm retyped from string|int to string.verified against source
7.0.0
The $algorithm parameter is now always a string.from the docblock
6.9.7
Parameter $algorithm retyped from string to string|int.verified against source
6.8.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.