W3cubDocs

/WordPress

wp_remote_retrieve_headers( array|WP_Error $response ): WpOrgRequestsUtilityCaseInsensitiveDictionary|array

Retrieves only the headers from the raw response.

Description

See also

Parameters

$responsearray|WP_Errorrequired
HTTP response.

Return

WpOrgRequestsUtilityCaseInsensitiveDictionary|array The headers of the response, or empty array if incorrect parameter given.

Source

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.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_remote_retrieve_headers