wp_remote_retrieve_cookies() WordPress Function
The wp_remote_retrieve_cookies() function is used to retrieve the cookies from a remote request. This function is useful for retrieving cookies from a remote request, such as when making a request to an external server.
wp_remote_retrieve_cookies( array|WP_Error $response ) #
Retrieve only the cookies from the raw response.
Parameters
- $response
(array|WP_Error)(Required)HTTP response.
Return
(WP_Http_Cookie[]) An array of WP_Http_Cookie
objects from the response. Empty array if there are none, or the response is a WP_Error.
Source
File: wp-includes/http.php
function wp_remote_retrieve_cookies( $response ) { if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) { return array(); } return $response['cookies']; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |