WordPress at a glance
Home All Function Functions APIs HTTP API

wp_remote_retrieve_headers() WP 1.0

Retrieve only the headers from the raw response.

Is the basis for: wp_get_http_headers()

No Hooks.


Array/\Requests_Utility_CaseInsensitiveDictionary. The headers of the response. Empty array if incorrect parameter given.


wp_remote_retrieve_headers( $response );
$response(array/WP_Error) (required)
HTTP response.


  • See: \Requests_Utility_CaseInsensitiveDictionary


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-includes/http.php WP 5.4.2

function wp_remote_retrieve_headers( $response ) {
	if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) {
		return array();

	return $response['headers'];

Related Functions

From tag: HTTP API (curl remote)

No comments
        Log In . Register