I'm trying to use error_log()
in a custom WordPress plugin I am building but for some reason, I can't.
When I use error_log()
my site just breaks, but I'm not seeing any errors in debug.log
.
I have setup debugging in my wp_config.php
file like this:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
Stranegly, if I use error_log()
in my theme, the site doesn't break, but nothing is output to debug.log
either.
What do I need to do to be able to use error_log()
in my WordPress plugin and theme?
I'm using WordPress 3.9.1.
According to the Codex, WP_DEBUG_DISPLAY
should be set to true by default, but it would seem that was not the case.
Adding define('WP_DEBUG_DISPLAY', true);
to wp_config.php
fixed the error logging.
Setting WP_DEBUG_DISPLAY
to false
removed the errors from the browser but allowed them to be output in the log.
It would seem that Wordpress requires define('WP_DEBUG_DISPLAY');
to output errors to the log whether you set it to be true
or false
.