WordPress has a Debug Mode, allowing you to get information when something goes wrong easily. You must add a constant to the WordPress wp-config.php file to enable or disable the debug mode. But what about an easy way to switch on the debug mode, even without accessing wp-config.php?
Disable the Debug mode in WordPress or enable it using a plugin
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.visualmodo.com/?debug=debug
What is Debug Mode?
Debugging PHP code is part of any project, but WordPress has specific debug systems designed to simplify the process and standardize code across the core, plugins, and themes. This page describes the various debugging tools in WordPress and how to be more product active in your coding and increase your code’s overall quality and interoperability.
WP_DEBUG
WP_DEBUG is a PHP constant (a permanent global variable) that can be used to trigger the “debug” mode throughout WordPress. It is assumed to be false by default and is usually set to true in the wp-config.php file on development copies of WordPress.
define( 'WP_DEBUG', true ); define( 'WP_DEBUG', false );
Note: The true and false values in the example are not surrounded by apostrophes (‘) because they are boolean (true/false) values. If you set constants to ‘false,’ they will be interpreted as accurate because the quotes make it a string rather than a boolean.
It is not recommended to use WP_DEBUG or the other debug tools on live sites; they are meant for local testing and staging installs.
History
The WP_DEBUG option was added in WordPress Version 2.3.1.
Starting with WordPress version 2.3.2, database errors are printed only if WP_DEBUG is set to true. In earlier versions, database errors were always printed. (Database errors are handled by the wpdb class and are not affected by PHP’s error settings.)
Starting with WordPress version 2.5, setting WP_DEBUG to true also raises the error reporting level to E_ALL and activates warnings when deprecated functions or files are used; otherwise, WordPress sets the error reporting level to E_ALL ^ E_NOTICE ^ E_USER_NOTICE.