We’re working on something like a series providing tips and talking about building solid WordPress themes. Today’s short tip is about setting debug options in your wp-config.php file.

WP_DEBUG handles error display in WordPress. If you’re building a theme you need to make sure that no errors are a result of your theme. You can set WP_DEBUG by:

[php]
define( ‘WP_DEBUG’, true );
[/php]

Closely related to this is SCRIPT_DEBUG. If you’re planning on modifying any of the javascript built in to WordPress you need to make sure that your modifications are not throwing any errors. Set SCRIPT_DEBUG in your wp-config.php file by:

[php]
define( ‘SCRIPT_DEBUG’, true );
[/php]

PHP has lots of error logging available so why don’t we also enable all of the error logs we can get out of PHP. You can do this directly out of your wp-config.php file with the following lines.

[php]
@ini_set(‘log_errors’,’On’);
@ini_set(‘display_errors’,’Off’);
@ini_set(‘error_log’,’/home/example.com/logs/php_error.log’);
[/php]

When you build any theme you should make sure that all of these are enabled (at least on development) and that nothing you’re doing is providing any errors for the site. When you do this you’ll also find a number of plugins that will fill the error logs. If you can find an alternative that doesn’t throw any errors.

If you’re looking for other posts in this series look at the tag Building Quality WordPress Themes.