wp_remote_retrieve_response_code
Retrieve only the response code from the raw response.
Description
(int|string) wp_remote_retrieve_response_code( (array) $response );
Will return an empty array if incorrect parameter value is given.
Returns (int|string)
The response code as an integer. Empty string on incorrect parameter given.
Parameters (1)
- 0. $response (array)
- HTTP response.
Usage
if ( !function_exists( 'wp_remote_retrieve_response_code' ) ) { require_once ABSPATH . WPINC . '/http.php'; } // HTTP response. $response = array(); // NOTICE! Understand what this does before running. $result = wp_remote_retrieve_response_code($response);
Defined (1)
The function is defined in the following location(s).
- /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'];
- }