One of the most important tools that any developer has at his or her disposal is the debugger.
Typically, these come as a standard part of the IDE for many compiled languages but many of us are now using scripting languages or interpreted languages to build our applications. In this case, debugging is a little bit different.
If you find yourself doing a lot of WordPress development and writing a lot of ‘echo’ or ‘print_r’ statements in order to figure out what’s going on with your code, here’s how you can enable debugging in the WordPress environment:
First, locate wp-config.php in the root of your WordPress installation. Find the line that reads:
[cc lang=”php”]
define(‘WP_DEBUG’, false);
[/cc]
And replace it with the following code:
[cc lang=”php”]
define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_LOG’, true);
define(‘WP_DEBUG_DISPLAY’, false);
@ini_set(‘display_errors’, 0);
[/cc]
This will take all debugging messages generated within the WordPress application and write them to a /wp-content/debug.log file in your installation directory.
Speak your mind...