rest_url( string $path = '', string $scheme = 'rest' )
Retrieves the URL to a REST endpoint.
Description
Note: The returned URL is NOT escaped.
Parameters
- $path
-
(string) (Optional) REST route.
Default value: ''
- $scheme
-
(string) (Optional) Sanitization scheme.
Default value: 'rest'
Return
(string) Full URL to the endpoint.
Source
File: wp-includes/rest-api.php
function rest_url( $path = '', $scheme = 'rest' ) { return get_rest_url( null, $path, $scheme ); }
Related
Uses
Uses | Description |
---|---|
wp-includes/rest-api.php: get_rest_url() | Retrieves the URL to a REST endpoint on a site. |
Used By
Used By | Description |
---|---|
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::add_site_logo_to_index() | Exposes the site logo through the WordPress REST API. |
wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php: WP_REST_Widgets_Controller::prepare_links() | Prepares links for the widget. |
wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php: WP_REST_Sidebars_Controller::prepare_links() | Prepares links for the sidebar. |
wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php: WP_REST_Templates_Controller::prepare_links() | Prepares links for the request. |
wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php: WP_REST_Widget_Types_Controller::prepare_links() | Prepares links for the widget type. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::add_active_theme_link_to_index() | Adds a link to the active theme for users who have proper permissions. |
wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php: WP_REST_Themes_Controller::prepare_links() | Prepares links for the request. |
wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php: WP_REST_Application_Passwords_Controller::prepare_links() | Prepares links for the request. |
wp-includes/rest-api/search/class-wp-rest-term-search-handler.php: WP_REST_Term_Search_Handler::prepare_item_links() | Prepares links for the search result of a given ID. |
wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php: WP_REST_Block_Directory_Controller::prepare_links() | Generates a list of links to include in the response for the plugin. |
wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php: WP_REST_Plugins_Controller::prepare_links() | Prepares links for the request. |
wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php: WP_REST_Plugins_Controller::create_item() | Uploads a plugin and optionally activates it. |
wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php: WP_REST_Block_Types_Controller::prepare_links() | Prepares links for the request. |
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php: WP_REST_Attachments_Controller::edit_media_item() | Applies edits to a media item and creates a new attachment record. |
wp-admin/includes/class-wp-site-health.php: WP_Site_Health::get_test_rest_availability() | Test if the REST API is accessible. |
wp-admin/includes/class-wp-site-health.php: WP_Site_Health::get_tests() | Return a set of tests that belong to the site status page. |
wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php: WP_REST_Search_Controller::get_items() | Retrieves a collection of search results. |
wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php: WP_REST_Search_Controller::prepare_item_for_response() | Prepares a single search result for response. |
wp-includes/rest-api/search/class-wp-rest-post-search-handler.php: WP_REST_Post_Search_Handler::prepare_item_links() | Prepares links for the search result of a given ID. |
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::get_schema_links() | Retrieve Link Description Objects that should be added to the Schema for the posts collection. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: WP_REST_Users_Controller::prepare_links() | Prepares links for the user request. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: WP_REST_Users_Controller::create_item() | Creates a single user. |
wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php: WP_REST_Users_Controller::get_items() | Retrieves all users. |
wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php: WP_REST_Revisions_Controller::prepare_item_for_response() | Prepares the revision for the REST response. |
wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php: WP_REST_Revisions_Controller::get_items() | Gets a collection of revisions. |
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php: WP_REST_Attachments_Controller::create_item() | Creates a single attachment. |
wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php: WP_REST_Post_Statuses_Controller::prepare_item_for_response() | Prepares a post status object for serialization. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php: WP_REST_Terms_Controller::prepare_links() | Prepares links for the request. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php: WP_REST_Terms_Controller::create_item() | Creates a single term in a taxonomy. |
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php: WP_REST_Terms_Controller::get_items() | Retrieves terms associated with a taxonomy. |
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::prepare_links() | Prepares links for the request. |
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::create_item() | Creates a single post. |
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php: WP_REST_Posts_Controller::get_items() | Retrieves a collection of posts. |
wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php: WP_REST_Taxonomies_Controller::prepare_item_for_response() | Prepares a taxonomy object for serialization. |
wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php: WP_REST_Post_Types_Controller::prepare_item_for_response() | Prepares a post type object for serialization. |
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php: WP_REST_Comments_Controller::prepare_links() | Prepares links for the request. |
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php: WP_REST_Comments_Controller::create_item() | Creates a comment. |
wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php: WP_REST_Comments_Controller::get_items() | Retrieves a list of comment items. |
wp-includes/rest-api/class-wp-rest-request.php: WP_REST_Request::from_url() | Retrieves a WP_REST_Request object from a full URL. |
wp-includes/rest-api.php: rest_output_link_wp_head() | Outputs the REST API link tag into page header. |
wp-includes/rest-api.php: rest_output_link_header() | Sends a Link header for the REST API. |
wp-includes/embed.php: get_oembed_endpoint_url() | Retrieves the oEmbed endpoint URL for a given permalink. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::get_data_for_route() | Retrieves publicly-visible data for the route. |
wp-includes/rest-api/class-wp-rest-server.php: WP_REST_Server::get_namespace_index() | Retrieves the index for a namespace. |
wp-includes/media.php: wp_enqueue_media() | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/rest_url