DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

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!

Tags

2 Comments

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

  2. please Please PLEASEtell people that this is a BAD idea to leave in your wp-config.php file permanently.
    Error messages are suppressed on purpose to prevent hackers from gaining valuable intel on your site/server’s config that they can then use against you.
    Remove this and turn DEBUG to FALSE when your site goes live.
    **shakes head in disbelief**

Leave a Comment

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