wp_remote_retrieve_headers( array|WP_Error $response ): WpOrgRequestsUtilityCaseInsensitiveDictionary|array
Retrieve only the headers from the raw response.
Contents
Description
See also
Parameters
-
$response
array|WP_Error Required -
HTTP response.
Return
WpOrgRequestsUtilityCaseInsensitiveDictionary|array The headers of the response, or empty array if incorrect parameter given.
Source
File: wp-includes/http.php
.
View all references
function wp_remote_retrieve_headers( $response ) {
if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) {
return array();
}
return $response['headers'];
}
Changelog
Version | Description |
---|---|
4.6.0 | Return value changed from an array to an WpOrgRequestsUtilityCaseInsensitiveDictionary instance. |
2.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
The returned value of
wp_remote_retrieve_headers($response)
will be something like this…To access only one value:
You can just type in the array key.
To get the whole array:
You have to use type cast
(array)
.