jetpack
jetpack copied to clipboard
Debug should not break XML/JSON
We should probably not output any debug messages if DOING_AJAX
, XMLRPC_REQUEST
, or REST_REQUEST
.
It'd be good to also include JSON_REQUEST
in this and 02d6a8e800be11291a7e5b4954fcd5ef4d93d778, for those running v1 of the REST API.
Related Automattic/wp-super-cache#22
Actually, I don't think v1 support is all that important anymore. I think most custom v1 endpoints have migrated to v2, or will soon.
ref: wp_cache_add_to_buffer()
https://github.com/Automattic/wp-super-cache/blob/f4cab722d73b88bac12042e2865be1fd3dc5042c/wp-cache-phase2.php#L593-L608
While that strpos will more than likely stop the plugin writing out html comments to non-html content we could also add in checks for those constants. I merged in a change that checked for various REST protocols yesterday, so the wp_cache_add_to_buffer() function could do something similar..
https://github.com/Automattic/wp-super-cache/blob/f4cab722d73b88bac12042e2865be1fd3dc5042c/wp-cache-phase2.php#L377-L380