wordpress / latest / functions / wp_remote_retrieve_cookie_value.html

wp_remote_retrieve_cookie_value( array|WP_Error $response, string $name ): string

Retrieve a single cookie’s value by name from the raw response.

Parameters

$response array|WP_Error Required
HTTP response.
$name string Required
The name of the cookie to retrieve.

Return

string The value of the cookie, or empty string if the cookie is not present in the response.

Source

File: wp-includes/http.php. View all references

function wp_remote_retrieve_cookie_value( $response, $name ) {
	$cookie = wp_remote_retrieve_cookie( $response, $name );

	if ( ! is_a( $cookie, 'WP_Http_Cookie' ) ) {
		return '';
	}

	return $cookie->value;
}

Changelog

Version Description
4.4.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookie_value