rest_api_loaded()
rest_api_loaded()
加载REST API。
Loads the REST API.
返回(Return)
无返回值
源码(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(); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
4.4.0 | wp-includes/rest-api.php:285 | 0 | 2 |
rest_api_loaded() 为WP2原创文章,链接:https://www.wp2.cn/functions/rest_api_loaded/