How to Debug Your WordPress Errors

How to Debug Your WordPress Errors

This week I was upgrading a WordPress site. It had a partial blank page in the admin. It wasn’t a full White Screen of Death, but there was clearly a bug that needed fixing.

This tutorial will help you to debug issues like this. I’m going to show you how to use WordPress’ debugger to find the cause of this issue.


Example Issue

As you can see in the example screenshot, nothing appears in the main content area. None of the admin pages work for me.

Without a detailed error message, I’m left guessing what the issue might be. Getting a detailed error message is the key to quickly resolving the issue.

In order to get a detailed error message, I’ll need to enable the wp-debug in the wp-config.php file.


Step #1. Edit your wp-config.php file

If you’re not familiar with the wp-config.php file, please check out our Guided Tour of it.

Use your host’s file manager and navigate to your WordPress root. Edit your wp-config.php file and look for the following line of code:
define(‘WP_DEBUG’, false);

Change that line of code to:
define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_LOG’, true);
define(‘WP_DEBUG_DISPLAY’, false);
@ini_set(‘display_errors’,0);

Afterward, save your file.

The above code will tell WordPress to start logging errors. It will output the errors to the wp-content/debug.log file.


Step #2. Examine your debug.log file

In the file manager, navigate to your wp-content folder. Within there, look for and edit the debug.log file.

At the bottom of your file, you should see your error message. Double check the date to make sure it’s the right one.

With this detailed error message, you should now be able to resolve the issue. It should tell you exactly what the issue is. From here, based on the error message, you’ll:

  • be able to Google for a solution
  • ask for help in our support forum or another forum
  • know exactly how to fix the issue yourself

It might require updating (or disabling) a plugin, theme, or PHP version. The detailed error message will be the key to figuring out what’s needed.


Step #3. Turn Off Debugging

Once you’re done, go back to your wp-config.php file and change:
define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_LOG’, true);
define(‘WP_DEBUG_DISPLAY’, false);
@ini_set(‘display_errors’,0);

back to:
define(‘WP_DEBUG’, false);

and save your file. That will change things back to normal.


Pro tip: White Screen of Death

The White Screen of Death (WSoD) is where the page is completely blank, not just partially. Sometimes the above steps won’t work and you’ll need additional debugging. If you’re in that situation, give our White Screen of Death tutorial a try.

If you have just updated a plugin and you’re seeing errors, try rolling back to a previous version.

Author

  • Nick Savov

    Nick is the Director of Support at OSTraining and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.

0 0 votes
Article Rating
Subscribe
Notify of
4 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Ron
Ron
3 years ago

You need to get rid of your smart/curly quotes. Or, was this example to illustrate a white screen of death?

Elisabeth
Elisabeth
3 years ago

How to do this if you can’t even login now?!! Help!!!!!!!!!!

Tom
Tom
3 years ago
Reply to  Elisabeth

I see you posted this back in September 2020. Were you able to resolve your issue Elisabeth?

a
a
3 years ago

where do I put this code

4
0
Would love your thoughts, please comment.x
()
x