HowTo – Enabling PHP Debug Error Code View In WordPress

Filed under: Wordpress Tips

wordpress-logoWhether you are working on a Plugin or a Theme there are times when you need to see all the Errors in your PHP Code.

Well because WordPress is written in PHP and the wp-config.php file is loaded on every page view this is the appropriate place to enable your PHP Debugging settings.

Now nothing is perfect in PHP Debug information but sometimes you may get pointed to a simple mistake that you can quickly fix.

To Enable PHP Debugging you have two different settings

WordPress Debug
To enable debug in WordPress you can place the following command in your wp-config.php file


// true means you want to turn it on…
define(‘WP_DEBUG’, true);
// or the default setting of off
define(‘WP_DEBUG’, false);


Now using the wordpress debug mode may not catch everything so you can also set your PHP debug setting in your wp-config.php file




This is about all you should need to setup your debug modes for your PHP code.

Remember Debug is not perfect and it will often point you to one thing but the problem is elsewhere.

When writing your code you may also want to use an editor like Komodo Edit that has debugging built in. Again not perfect but it can help you catch some of your bad code habits.