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

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


Parameters Parameters

$response

(array|WP_Error) (Required) HTTP response.

$name

(string) (Required) The name of the cookie to retrieve.


Top ↑

Return Return

(string) The value of the cookie. Empty string if the cookie isn't present in the response.


Top ↑

Source Source

File: wp-includes/http.php

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;
}


Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.