WP_Application_Passwords::chunk_passwordpublic staticWP 5.6.0

Sanitizes and then splits a password into smaller chunks.

Method of the class: WP_Application_Passwords{}

No Hooks.

Returns

String. The chunked password.

Usage

$result = WP_Application_Passwords::chunk_password( $raw_password );
$raw_password(string) (required)

The raw application password.

It has the attribute #[\SensitiveParameter], which hides the value of the parameter from logs. It is used to protect sensitive data (for example, passwords). Documentation.

Changelog

Since 5.6.0 Introduced.

WP_Application_Passwords::chunk_password() code WP 6.9.1

public static function chunk_password(
	#[\SensitiveParameter]
	$raw_password
) {
	$raw_password = preg_replace( '/[^a-z\d]/i', '', $raw_password );

	return trim( chunk_split( $raw_password, 4, ' ' ) );
}