Changeset 57312 for trunk/src/wp-includes/functions.php
- Timestamp:
- 01/19/2024 05:37:05 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r57279 r57312 3719 3719 */ 3720 3720 $callback = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' ); 3721 } elseif ( defined( 'REST_REQUEST' ) && REST_REQUEST&& wp_is_jsonp_request() ) {3721 } elseif ( wp_is_serving_rest_request() && wp_is_jsonp_request() ) { 3722 3722 /** 3723 3723 * Filters the callback for killing WordPress execution for JSONP REST requests. … … 4442 4442 */ 4443 4443 function wp_send_json( $response, $status_code = null, $flags = 0 ) { 4444 if ( defined( 'REST_REQUEST' ) && REST_REQUEST) {4444 if ( wp_is_serving_rest_request() ) { 4445 4445 _doing_it_wrong( 4446 4446 __FUNCTION__, … … 4698 4698 } 4699 4699 4700 /** 4701 * Determines whether WordPress is currently serving a REST API request. 4702 * 4703 * The function relies on the 'REST_REQUEST' global. As such, it only returns true when an actual REST _request_ is 4704 * being made. It does not return true when a REST endpoint is hit as part of another request, e.g. for preloading a 4705 * REST response. See {@see wp_is_rest_endpoint()} for that purpose. 4706 * 4707 * This function should not be called until the {@see 'parse_request'} action, as the constant is only defined then, 4708 * even for an actual REST request. 4709 * 4710 * @since 6.5.0 4711 * 4712 * @return bool True if it's a WordPress REST API request, false otherwise. 4713 */ 4714 function wp_is_serving_rest_request() { 4715 return defined( 'REST_REQUEST' ) && REST_REQUEST; 4716 } 4700 4717 4701 4718 /**
Note: See TracChangeset
for help on using the changeset viewer.