wp_remote_retrieve_cookie( array|WP_Error $response, string $name )
Retrieve a single cookie by name from the raw response.
Description Description
Parameters Parameters
- $response
-
(array|WP_Error) (Required) HTTP response.
- $name
-
(string) (Required) The name of the cookie to retrieve.
Return Return
(WP_Http_Cookie|string) The WP_Http_Cookie
object. Empty string if the cookie isn't present in the response.
Source Source
File: wp-includes/http.php
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 ''; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
User Contributed Notes User Contributed Notes
-
Skip to note 1 content You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note