wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
rest_api_loaded › WordPress Function
Seit4.4.0
Veraltetn/v
› rest_api_loaded ( Keine Parameter )
Definiert in: |
|
Codex: |
Loads the REST API.
Ähnliche Funktionen: rest_api_init, restore_previous_locale, rest_is_object, rest_is_ip_address, rest_is_boolean
Quellcode
function rest_api_loaded() { if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) ) { 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(); }