Skip to content
Home » Blog » Debugging WordPress

Debugging WordPress

If you accidentally introduce a syntax or fatal error in one of your template files, you’ll probably see the dreaded white screen of death when you visit your home page. In some cases, even the admin screens will go blank. The best way to figure out what happened is to check your PHP error log. Look for the last error shown and try to correct it. However, if you can’t find your error log (or you don’t have one), you can turn on debugging by adding define('WP_DEBUG', true); to your wp-config.php file.

The problem with this method, though, is that everyone who visits the site will see your errors. Fortunately there is an alternative, which lets you enter debug mode by adding a query string to any URL.

if ( isset($_GET['debug']) && $_GET['debug'] == 'debug')
define('WP_DEBUG', true);

Then you can just add ?debug=debug to your URL (e.g. to see the errors.

The white screen of death usually comes up when you update a theme or plugin. If your theme has gone horribly wrong and you just want to switch back to another one, but you can’t access the admin screens to change it, don’t panic. Simply delete or rename your active theme’s directory. When WordPress can’t find it, it will revert to the default theme. You can also deactivate an error-causing plugin by deleting or renaming its directory. WordPress will automatically deactivate it.

2 thoughts on “Debugging WordPress”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.