On this page
wp_remote_get( string $url, array $args = array() ): array|WP_Error
Performs an HTTP request using the GET method and returns its response.
Description
See also
- wp_remote_request() : For more information on the response array format.
- WP_Http::request(): For default arguments information.
Parameters
$urlstring Required-
URL to retrieve.
$argsarray Optional-
Request arguments.
Default:
array()
Return
More Information
Use wp_remote_retrieve_body( $response ) to get the response body.
Use wp_remote_retrieve_response_code( $response ) to get the HTTP status code for the response.
Use related functions in wp-includes/http.php to get other parameters such as headers.
See WP_Http_Streams::request() method located in wp-includes/class-wp-http-streams.php for the format of the array returned by wp_remote_get() .
Source
File: wp-includes/http.php. View all references
function wp_remote_get( $url, $args = array() ) {
$http = _wp_http_get_object();
return $http->get( $url, $args );
}
Related
Uses
| Uses | Description |
|---|---|
| _wp_http_get_object() wp-includes/http.php | Returns the initialized WP_Http Object |
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_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_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_Debug_Data::debug_data() wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| 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::get_test_dotorg_communication() wp-admin/includes/class-wp-site-health.php | Tests if the site can communicate with WordPress.org. |
| 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. |
| wp_install_maybe_enable_pretty_permalinks() wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. |
| 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. |
| 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. |
| plugins_api() wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins 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. |
| url_is_accessable_via_ssl() wp-includes/deprecated.php | Determines if the URL can be accessed over SSL. |
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_get