WordPress at a glance

wp_remote_retrieve_response_code() WP 1.0

Retrieve only the response code from the raw response.

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

No Hooks.


Int|String. The response code as an integer. Empty string on incorrect parameter given.


wp_remote_retrieve_response_code( $response );
$response(array|WP_Error) (required)
HTTP response.


Since 2.7.0 Introduced.

Code of wp_remote_retrieve_response_code() WP 5.7.2

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

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

From tag: HTTP API (curl remote)

No comments
    Log In