On this page
wp_remote_retrieve_response_code( array|WP_Error $response ): int|string
Retrieve only the response code from the raw response.
Description
Will return an empty string if incorrect parameter value is given.
Parameters
$responsearray|WP_Error Required-
HTTP response.
Return
int|string The response code as an integer. Empty string if incorrect parameter given.
Source
File: wp-includes/http.php. View all references
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
Uses
| Uses | Description |
|---|---|
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Used By
| Used By | Description |
|---|---|
| WP_Site_Health::check_for_page_caching() wp-admin/includes/class-wp-site-health.php | Checks if site has page cache enabled or not. |
| WP_REST_URL_Details_Controller::get_remote_url() wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Retrieves the document title from a remote URL. |
| wp_update_https_detection_errors() wp-includes/https-detection.php | Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. |
| WP_Site_Health::wp_cron_scheduled_check() wp-admin/includes/class-wp-site-health.php | Runs the scheduled event to check and update the latest site health status for the website. |
| WP_Site_Health::get_test_rest_availability() wp-admin/includes/class-wp-site-health.php | Tests if the REST API is accessible. |
| WP_Site_Health::can_perform_loopback() wp-admin/includes/class-wp-site-health.php | Runs a loopback test on the site. |
| wp_check_php_version() wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| WP_Community_Events::get_events() wp-admin/includes/class-wp-community-events.php | Gets data about events near a particular location. |
| populate_network() wp-admin/includes/schema.php | Populate network settings. |
| get_core_checksums() wp-admin/includes/update.php | Gets and caches the checksums for the given version of WordPress. |
| wp_check_browser_version() wp-admin/includes/dashboard.php | Checks if the user needs a browser update. |
| download_url() wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. |
| wp_credits() wp-admin/includes/credits.php | Retrieve the contributor credits. |
| url_is_accessable_via_ssl() wp-includes/deprecated.php | Determines if the URL can be accessed over SSL. |
| wp_get_http() wp-includes/deprecated.php | Perform a HTTP HEAD or GET request. |
| WP_SimplePie_File::__construct() wp-includes/class-wp-simplepie-file.php | Constructor. |
| wp_version_check() wp-includes/update.php | Checks WordPress version against the newest version. |
| wp_update_plugins() wp-includes/update.php | Checks for available updates to plugins based on the latest versions hosted on WordPress.org. |
| wp_update_themes() wp-includes/update.php | Checks for available updates to themes based on the latest versions hosted on WordPress.org. |
| WP_oEmbed::_fetch_with_format() wp-includes/class-wp-oembed.php | Fetches result from an oEmbed provider for a specific format and complete provider URL |
| WP_HTTP_IXR_Client::query() wp-includes/class-wp-http-ixr-client.php | |
| _fetch_remote_file() wp-includes/rss.php | Retrieve URL headers and content using WP HTTP Request API. |
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_remote_retrieve_response_code