WP_Application_Passwords::chunk_password() WordPress Method

The WP_Application_Passwords::chunk_password() method is used to break a password into chunks for transport. This is useful when storing passwords in a database or other storage system that imposes a maximum length on the data that can be stored. By breaking the password into multiple chunks, it can be stored in multiple records, each under the maximum length. When retrieving the password, the chunks can be concatenated to reconstruct the original password.

WP_Application_Passwords::chunk_password( string $raw_password ) #

Sanitizes and then splits a password into smaller chunks.


Parameters

$raw_password

(string)(Required)The raw application password.


Top ↑

Return

(string) The chunked password.


Top ↑

Source

File: wp-includes/class-wp-application-passwords.php

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

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


Top ↑

Changelog

Changelog
VersionDescription
5.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.