Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

WP_Recovery_Mode_Cookie_Service::generate_cookie() WordPress Method

The generate_cookie() method is used to generate a cookie that can be used to enable the WordPress Recovery Mode. This cookie is generated using a secret key that is stored in the WordPress database. The cookie is then set to expire in 24 hours.

WP_Recovery_Mode_Cookie_Service::generate_cookie() #

Generates the recovery mode cookie value.


Description

The cookie is a base64 encoded string with the following format:

recovery_mode|iat|rand|signature

Where "recovery_mode" is a constant string, iat is the time the cookie was generated at, rand is a randomly generated password that is also used as a session identifier and signature is an hmac of the preceding 3 parts.


Top ↑

Return

(string) Generated cookie content.


Top ↑

Source

File: wp-includes/class-wp-recovery-mode-cookie-service.php

	private function generate_cookie() {
		$to_sign = sprintf( 'recovery_mode|%s|%s', time(), wp_generate_password( 20, false ) );
		$signed  = $this->recovery_mode_hash( $to_sign );

		return base64_encode( sprintf( '%s|%s', $to_sign, $signed ) );
	}


Top ↑

Changelog

Changelog
VersionDescription
5.2.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.