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::parse_cookie() WordPress Method

The WP_Recovery_Mode_Cookie_Service::parse_cookie() takes a user-provided cookie string and parses it into an array. This is used to retrieve information about a user's login session, such as their username and password.

WP_Recovery_Mode_Cookie_Service::parse_cookie( string $cookie ) #

Parses the cookie into its four parts.


Parameters

$cookie

(string)(Required)Cookie content.


Top ↑

Return

(array|WP_Error) Cookie parts array, or error object on failure.


Top ↑

Source

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

	private function parse_cookie( $cookie ) {
		$cookie = base64_decode( $cookie );
		$parts  = explode( '|', $cookie );

		if ( 4 !== count( $parts ) ) {
			return new WP_Error( 'invalid_format', __( 'Invalid cookie format.' ) );
		}

		return $parts;
	}


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.