wp_remote_retrieve_response_code( array|WP_Error $response )
Retrieve only the response code from the raw response.
Description Description
Will return an empty array if incorrect parameter value is given.
Parameters Parameters
- $response
-
(array|WP_Error) (Required) HTTP response.
Return Return
(int|string) The response code as an integer. Empty string on incorrect parameter given.
Source 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']; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Examples
$response
code will contain a string representing the numeric response code sent from the server