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