WordPress at a glance
Home All Function Functions APIs HTTP API

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.

Return

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

Usage

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

Code of wp remote retrieve response code: wp-includes/http.php WP 5.2.1

<?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'];
}

Related Functions

From tag: HTTP API (curl remote)

No comments
    Hello, !     Log In . Register