On this page
WP_Recovery_Mode_Cookie_Service::parse_cookie( string $cookie ): array|WP_Error
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.
Parses the cookie into its four parts.
Parameters
$cookiestring Required-
Cookie content.
Return
array|WP_Error Cookie parts array, or error object on failure.
Source
File: wp-includes/class-wp-recovery-mode-cookie-service.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| WP_Error::__construct() wp-includes/class-wp-error.php | Initializes the error. |
Used By
| Used By | Description |
|---|---|
| WP_Recovery_Mode_Cookie_Service::validate_cookie() wp-includes/class-wp-recovery-mode-cookie-service.php | Validates the recovery mode cookie. |
| WP_Recovery_Mode_Cookie_Service::get_session_id_from_cookie() wp-includes/class-wp-recovery-mode-cookie-service.php | Gets the session identifier from the cookie. |
Changelog
| Version | Description |
|---|---|
| 5.2.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_recovery_mode_cookie_service/parse_cookie