How to easily enable-disable debug mode in WordPress when something goes wrong

WordPress have a debug mode which allow you to easily get information when something goes wrong. To enable the debug mode, you have to add a constant to the wp-config.php file. But what about an easy way to switch on the debug mode, even without accessing wp-config.php?

The first thing to do is to add the following code to your wp-config.php file. This file is located at the root of your WordPress install.

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

Once done, simply add a GET parameter to the url of the page you’d like to debug, as shown below:


Leave a Reply

Your email address will not be published. Required fields are marked *