wp_remote_retrieve_headers() WP 1.0
Retrieve only the headers from the raw response.
Basis of: wp_get_http_headers()
No Hooks.
Return
Array/\Requests_Utility_CaseInsensitiveDictionary. The headers of the response. Empty array if incorrect parameter given.
Usage
wp_remote_retrieve_headers( $response );
- $response(array/WP_Error) (required)
- HTTP response.
Notes
- See: \Requests_Utility_CaseInsensitiveDictionary
Changelog
Since 2.7.0 | Introduced. |
Since 4.6.0 | Return value changed from an array to an Requests_Utility_CaseInsensitiveDictionary instance. |
Code of wp_remote_retrieve_headers() wp remote retrieve headers WP 5.6
function wp_remote_retrieve_headers( $response ) {
if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) {
return array();
}
return $response['headers'];
}