Changeset 57312 for trunk/src/wp-includes/rest-api.php
- Timestamp:
- 01/19/2024 05:37:05 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r56834 r57312 210 210 */ 211 211 function rest_api_default_filters() { 212 if ( defined( 'REST_REQUEST' ) && REST_REQUEST) {212 if ( wp_is_serving_rest_request() ) { 213 213 // Deprecated reporting. 214 214 add_action( 'deprecated_function_run', 'rest_handle_deprecated_function', 10, 3 ); … … 3390 3390 return new WP_REST_Response( $data, $status ); 3391 3391 } 3392 3393 /** 3394 * Checks whether a REST API endpoint request is currently being handled. 3395 * 3396 * This may be a standalone REST API request, or an internal request dispatched from within a regular page load. 3397 * 3398 * @since 6.5.0 3399 * 3400 * @global WP_REST_Server $wp_rest_server REST server instance. 3401 * 3402 * @return bool True if a REST endpoint request is currently being handled, false otherwise. 3403 */ 3404 function wp_is_rest_endpoint() { 3405 /* @var WP_REST_Server $wp_rest_server */ 3406 global $wp_rest_server; 3407 3408 // Check whether this is a standalone REST request. 3409 $is_rest_endpoint = wp_is_serving_rest_request(); 3410 if ( ! $is_rest_endpoint ) { 3411 // Otherwise, check whether an internal REST request is currently being handled. 3412 $is_rest_endpoint = isset( $wp_rest_server ) 3413 && $wp_rest_server->is_dispatching(); 3414 } 3415 3416 /** 3417 * Filters whether a REST endpoint request is currently being handled. 3418 * 3419 * This may be a standalone REST API request, or an internal request dispatched from within a regular page load. 3420 * 3421 * @since 6.5.0 3422 * 3423 * @param bool $is_request_endpoint Whether a REST endpoint request is currently being handled. 3424 */ 3425 return (bool) apply_filters( 'wp_is_rest_endpoint', $is_rest_endpoint ); 3426 }
Note: See TracChangeset
for help on using the changeset viewer.