Retrieves a single cookie by name from the raw response.
Parameters
$response
array|WP_Errorrequired- HTTP response.
$name
stringrequired- The name of the cookie to retrieve.
Source
function wp_remote_retrieve_cookie( $response, $name ) {
$cookies = wp_remote_retrieve_cookies( $response );
if ( empty( $cookies ) ) {
return '';
}
foreach ( $cookies as $cookie ) {
if ( $cookie->name === $name ) {
return $cookie;
}
}
return '';
}
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
User Contributed Notes