wp-includes/rest-api.php:436Loads the REST API.
function rest_api_loaded() { if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) ) { return; } // Short-circuit before define()/die() if a REST dispatch is already in flight. // serve_request() enforces this too; guarding here avoids the trailing die(). if ( isset( $GLOBALS['wp_rest_server'] ) && $GLOBALS['wp_rest_server'] instanceof WP_REST_Server && $GLOBALS['wp_rest_server']->is_dispatching() ) { return; } // Return an error message if query_var is not a string. if ( ! is_string( $GLOBALS['wp']->query_vars['rest_route'] ) ) { $rest_type_error = new WP_Error( 'rest_path_invalid_type', __( 'The REST route parameter must be a string.' ), array( 'status' => 400 ) ); wp_die( $rest_type_error ); } /** * 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();}Introduced in 4.4.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/rest-api.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.