File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2209,7 +2209,14 @@ function wp_cache_append_tag( &$buffer ) {
22092209 $ msg = "Live page served on $ timestamp " ;
22102210 }
22112211
2212- if ( strpos ( $ buffer , '<html ' ) === false ) {
2212+ // Don't output debug message if we aren't handling a normal HTML response.
2213+ if (
2214+ strpos ( $ buffer , '<html ' ) === false ||
2215+ ( defined ( 'REST_REQUEST ' ) && REST_REQUEST ) ||
2216+ ( defined ( 'JSON_REQUEST ' ) && JSON_REQUEST ) ||
2217+ ( defined ( 'WC_API_REQUEST ' ) && WC_API_REQUEST ) ||
2218+ ( function_exists ( 'wp_doing_ajax ' ) && wp_doing_ajax () )
2219+ ) {
22132220 wp_cache_debug ( site_url ( $ _SERVER ['REQUEST_URI ' ] ) . ' - ' . $ msg );
22142221 return false ;
22152222 }
@@ -2228,7 +2235,14 @@ function wp_cache_add_to_buffer( &$buffer, $text ) {
22282235 return false ;
22292236 }
22302237
2231- if ( strpos ( $ buffer , '<html ' ) === false ) {
2238+ // Don't output debug message if we aren't handling a normal HTML response.
2239+ if (
2240+ strpos ( $ buffer , '<html ' ) === false ||
2241+ ( defined ( 'REST_REQUEST ' ) && REST_REQUEST ) ||
2242+ ( defined ( 'JSON_REQUEST ' ) && JSON_REQUEST ) ||
2243+ ( defined ( 'WC_API_REQUEST ' ) && WC_API_REQUEST ) ||
2244+ ( function_exists ( 'wp_doing_ajax ' ) && wp_doing_ajax () )
2245+ ) {
22322246 wp_cache_debug ( site_url ( $ _SERVER ['REQUEST_URI ' ] ) . ' - ' . $ text );
22332247 return false ;
22342248 }
You can’t perform that action at this time.
0 commit comments