Post Pic

How to easily enable/disable debug mode in WordPress

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:

http://www.wprecipes.com/contact?debug=debug

Thanks to Joost de Valk for this great tip!

One Response

Jan 28 2013 17:54

A clean/simple approach we do a very similar thing when debugging in conjunction with our inhouse plugin http://wordpress.org/extend/plugins/debugwp/

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required

WP Theme of the week

Sponsored Likebox