wp_remote_retrieve_headers

The timeline below displays how wordpress function wp_remote_retrieve_headers has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Retrieve only the headers from the raw response.
 *
 * @since 2.7.0
 * @since 4.6.0 Return value changed from an array to an WpOrg\Requests\Utility\CaseInsensitiveDictionary instance.
 *
 * @see \WpOrg\Requests\Utility\CaseInsensitiveDictionary
 *
 * @param array|WP_Error $response HTTP response.
 * @return \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array The headers of the response, or empty array
 *                                                                 if incorrect parameter given.
 */
function wp_remote_retrieve_headers($response)
{
    if (is_wp_error($response) || !isset($response['headers'])) {
        return array();
    }
    return $response['headers'];
}

WordPress Version: 6.1

/**
 * Retrieve only the headers from the raw response.
 *
 * @since 2.7.0
 * @since 4.6.0 Return value changed from an array to an Requests_Utility_CaseInsensitiveDictionary instance.
 *
 * @see \Requests_Utility_CaseInsensitiveDictionary
 *
 * @param array|WP_Error $response HTTP response.
 * @return \Requests_Utility_CaseInsensitiveDictionary|array The headers of the response, or empty array
 *                                                           if incorrect parameter given.
 */
function wp_remote_retrieve_headers($response)
{
    if (is_wp_error($response) || !isset($response['headers'])) {
        return array();
    }
    return $response['headers'];
}

WordPress Version: 5.3

/**
 * Retrieve only the headers from the raw response.
 *
 * @since 2.7.0
 * @since 4.6.0 Return value changed from an array to an Requests_Utility_CaseInsensitiveDictionary instance.
 *
 * @see \Requests_Utility_CaseInsensitiveDictionary
 *
 * @param array|WP_Error $response HTTP response.
 * @return array|\Requests_Utility_CaseInsensitiveDictionary The headers of the response. Empty array if incorrect parameter given.
 */
function wp_remote_retrieve_headers($response)
{
    if (is_wp_error($response) || !isset($response['headers'])) {
        return array();
    }
    return $response['headers'];
}

WordPress Version: 4.7

/**
 * Retrieve only the headers from the raw response.
 *
 * @since 2.7.0
 * @since 4.6.0 Return value changed from an array to an Requests_Utility_CaseInsensitiveDictionary instance.
 *
 * @see \Requests_Utility_CaseInsensitiveDictionary
 *
 * @param array $response HTTP response.
 * @return array|\Requests_Utility_CaseInsensitiveDictionary The headers of the response. Empty array if incorrect parameter given.
 */
function wp_remote_retrieve_headers($response)
{
    if (is_wp_error($response) || !isset($response['headers'])) {
        return array();
    }
    return $response['headers'];
}

WordPress Version: 4.6

/**
 * Retrieve only the headers from the raw response.
 *
 * @since 2.7.0
 *
 * @param array $response HTTP response.
 * @return array The headers of the response. Empty array if incorrect parameter given.
 */
function wp_remote_retrieve_headers($response)
{
    if (is_wp_error($response) || !isset($response['headers'])) {
        return array();
    }
    return $response['headers'];
}

WordPress Version: 4.0

/**
 * Retrieve only the headers from the raw response.
 *
 * @since 2.7.0
 *
 * @param array $response HTTP response.
 * @return array The headers of the response. Empty array if incorrect parameter given.
 */
function wp_remote_retrieve_headers($response)
{
    if (is_wp_error($response) || !isset($response['headers']) || !is_array($response['headers'])) {
        return array();
    }
    return $response['headers'];
}

WordPress Version: 3.7

/**
 * Retrieve only the headers from the raw response.
 *
 * @since 2.7.0
 *
 * @param array $response HTTP response.
 * @return array The headers of the response. Empty array if incorrect parameter given.
 */
function wp_remote_retrieve_headers(&$response)
{
    if (is_wp_error($response) || !isset($response['headers']) || !is_array($response['headers'])) {
        return array();
    }
    return $response['headers'];
}