Released: Turn on Debug plugin

(Piet) #1

To troubleshoot issues on client sites, we of course would like to quickly set WP_DEBUG to true. Not all clients are willing (or able) to fiddle with the wp-config.php file of their site, so then what?

That is why I have come with this Turn On Debug plugin, you can quickly install it on a client’s site, have a look at the output, troubleshoot the issue(s) and deactivate the plugin to set WP_DEBUG back to false.

The SO Turn On Debug plugin is available via the WP Plugins Directory and input is welcome via Github.

(Anh Tran) #2

I usually add this to wp-config.php:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

This will log all errors notices and warnings to a file called debug.log in wp-content folder. The errors won’t show in the frontend, but we can still see it in the log file.

(Piet) #3

Yeah, the purpose of the plugin is when a client cannot or doesn’t want to touch the wp-config file.

In such a scenario most likely the client also cannot give you access to the location of the error log file…

(Russell Heimlich) #4

I like to wrap the debug statement in a conditional so I can turn it on and off per request. like so:

if ( isset( $_GET['debug'] ) && 'password' === $_GET['debug'] ) {
  define( 'WP_DEBUG', true );

if (  defined('WP_DEBUG') && constant('WP_DEBUG') ) {
   define( 'WP_DEBUG_DISPLAY', true );

Now whenever I add ?debug=password to the end of a URL debugging will be enabled. Helpful whenever you get the white screen of death.

(Piet) #5

That is very handy indeed, but again for that to work, you need access to the wp-config.php file of the client.

By the way, WP_DEBUG_DISPLAY is set to true by default, so there is not need to separately declare it.

(David Gwyer) #6

I just released an update to my Config Constants plugin a few days ago which does something similar. I’d been meaning to update it for a long time but only just got round to it. Other WP constants are supported too and I’ll be adding more soon.