I'm trying to disable WP_DEBUG_LOG
if and only if debug.log
exists. I'd like to hook into wp_footer
and test if the file exists and if so disable my debug log. All I've found though is that WP_DEBUG_LOG
is a constant and can only be changed from the wp-config.php
file which is too early for my case. Is there a way to change it from a constant on install and keep it working as normal?
My only other thought is to create an option on install in the options table and just check it every time wp-config
loaded to see if the value has changed but I was wanting to avoid that.
Granted I could check if the file exists before I define WP_DEBUG_LOG
but somebody would have to view a page twice before debug log actually exists and is detected by the file_exists()
(since it's run very early) which is not optimal.
Does anybody know of a workaround to programmatically turn off WP_DEBUG_LOG
?
WP_DEBUG_LOG
in a mu-plugin. Debug log just loadsini_set('error_log')
so you can set it that way as well instead of using a WP constant.