Changeset 43983
- Timestamp:
- 12/12/2018 03:07:58 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43730
- Property svn:mergeinfo changed
-
trunk/src/wp-includes/load.php
r43571 r43983 350 350 } 351 351 352 if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) || wp_doing_ajax() ) {352 if ( defined( 'XMLRPC_REQUEST' ) || defined( 'REST_REQUEST' ) || ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) || wp_doing_ajax() || wp_is_json_request() ) { 353 353 @ini_set( 'display_errors', 0 ); 354 354 } … … 1251 1251 echo "\n###### wp_scraping_result_end:$scrape_key ######\n"; 1252 1252 } 1253 1254 /** 1255 * Checks whether current request is a JSON request, or is expecting a JSON response. 1256 * 1257 * @since 5.0.0 1258 * 1259 * @return bool True if Accepts or Content-Type headers contain application/json, false otherwise. 1260 */ 1261 function wp_is_json_request() { 1262 1263 if ( isset( $_SERVER['HTTP_ACCEPT'] ) && false !== strpos( $_SERVER['HTTP_ACCEPT'], 'application/json' ) ) { 1264 return true; 1265 } 1266 1267 if ( isset( $_SERVER['CONTENT_TYPE'] ) && 'application/json' === $_SERVER['CONTENT_TYPE'] ) { 1268 return true; 1269 } 1270 1271 return false; 1272 1273 }
Note: See TracChangeset
for help on using the changeset viewer.