On this page
wp_remote_retrieve_body( array|WP_Error $response ): string
Retrieve only the body from the raw response.
Parameters
$responsearray|WP_Error Required-
HTTP response.
Return
string The body of the response. Empty string if no body or incorrect parameter given.
Source
File: wp-includes/http.php. View all references
function wp_remote_retrieve_body( $response ) {
if ( is_wp_error( $response ) || ! isset( $response['body'] ) ) {
return '';
}
return $response['body'];
}
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_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_REST_Pattern_Directory_Controller::get_items() wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Search and retrieve block patterns metadata |
| get_block_editor_theme_styles() wp-includes/block-editor.php | Creates an array of theme styles to load into the block editor. |
| 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_check_php_version() wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| wp_edit_theme_plugin_file() wp-admin/includes/file.php | Attempts to edit a file for a theme or plugin. |
| WP_Community_Events::get_events() wp-admin/includes/class-wp-community-events.php | Gets data about events near a particular location. |
| translations_api() wp-admin/includes/translation-install.php | Retrieve translations from WordPress Translation API. |
| network_step2() wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| themes_api() wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| 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. |
| plugins_api() wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| download_url() wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. |
| wp_get_popular_importers() wp-admin/includes/import.php | Returns a list from WordPress.org of popular importer plugins. |
| wp_credits() wp-admin/includes/credits.php | Retrieve the contributor credits. |
| wp_remote_fopen() wp-includes/functions.php | HTTP request for URI to retrieve content. |
| 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::discover() wp-includes/class-wp-oembed.php | Attempts to discover link tags at the given URL for an oEmbed provider. |
| 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. |
| wp_xmlrpc_server::pingback_ping() wp-includes/class-wp-xmlrpc-server.php | Retrieves a pingback and registers it. |
| discover_pingback_server_uri() wp-includes/comment.php | Finds a pingback server URI based on the given URL. |
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_body