Uses
Uses | Description |
---|---|
wp-includes/rest-api.php: rest_get_server() | Retrieves the current REST server instance. |
wp-includes/formatting.php: untrailingslashit() | Removes trailing forward slashes and backslashes if they exist. |
Loads the REST API.
File: wp-includes/rest-api.php
function rest_api_loaded() { if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) ) { return; } /** * Whether this is a REST Request. * * @since 4.4.0 * @var bool */ define( 'REST_REQUEST', true ); // Initialize the server. $server = rest_get_server(); // Fire off the request. $route = untrailingslashit( $GLOBALS['wp']->query_vars['rest_route'] ); if ( empty( $route ) ) { $route = '/'; } $server->serve_request( $route ); // We're done. die(); }
Version | Description |
---|---|
4.4.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/rest_api_loaded