wp_remote_retrieve_response_code( array $response )

Retrieve only the response code from the raw response.


Description

Will return an empty array if incorrect parameter value is given.


Parameters

$response

(array) (Required) HTTP response.


Return

(int|string) The response code as an integer. Empty string on incorrect parameter given.


Source

File: wp-includes/http.php

function wp_remote_retrieve_response_code( $response ) {
	if ( is_wp_error($response) || ! isset($response['response']) || ! is_array($response['response']))
		return '';

	return $response['response']['code'];
}


Changelog

Changelog
Version Description
WP-2.7.0 Introduced.