On this page
wp_remote_retrieve_headers( array|WP_Error $response ): Requests_Utility_CaseInsensitiveDictionary|array
Retrieve only the headers from the raw response.
Description
See also
Parameters
$responsearray|WP_Error Required-
HTTP response.
Return
Requests_Utility_CaseInsensitiveDictionary|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'];
}
Related
Uses
| Uses | Description |
|---|---|
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Used By
| Used By | Description |
|---|---|
| wp_get_http() wp-includes/deprecated.php | Perform a HTTP HEAD or GET request. |
| wp_get_http_headers() wp-includes/functions.php | Retrieves HTTP Headers from URL. |
| WP_SimplePie_File::__construct() wp-includes/class-wp-simplepie-file.php | Constructor. |
| _fetch_remote_file() wp-includes/rss.php | Retrieve URL headers and content using WP HTTP Request API. |
Changelog
| Version | Description |
|---|---|
| 4.6.0 | Return value changed from an array to an Requests_Utility_CaseInsensitiveDictionary instance. |
| 2.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_remote_retrieve_headers