wpseek.com
A WordPress-centric search engine for devs and theme authors
rest_api_loaded › WordPress Function
Since4.4.0
Deprecatedn/a
› rest_api_loaded ( No parameters )
Defined at: |
|
Codex: |
Loads the REST API.
Related Functions: rest_api_init, restore_previous_locale, rest_is_object, rest_is_ip_address, rest_is_boolean
Source
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(); }