How to Diagnose and Troubleshoot WordPress

Occasionally while editing a site, I’ll get a blank screen or even an error message. The latest version of WordPress has made some nice upgrades to show a formatted error message, like this:

Along with this message, an email with more details will be sent out describing the error.

An additional step I’ve taken to diagnose errors is to turn on debug logging for my WordPress install. You’ll need to be familiar with FTP and your WordPress install location to do this part.

The file I have highlighted in the screenshot above is called “wp-config.php”. We’re going to add a few lines of code to this file so that WordPress will start logging errors.

Open the file “wp-config.php” and look for this line:

define( 'wp_DEBUG', true );

Replace that line with the following 3 lines:

define( 'wp_DEBUG', true );
define( 'wp_DEBUG_LOG', true );
define( 'wp_DEBUG_DISPLAY', false );

Now, reload your site, wait for the error screen to show, and WordPress will now have logged an error in a file. You’ll find this file in the wp-content directory.

Open the file debug.log and you’ll see details on what error is being received and which file has caused it.

In my experience, the issue has been with a plugin. We’re going to focus on that issue for this next section. If you are experiencing a separate issue, please feel free to contact me.

How to Troubleshoot a Plugin Error

Most of the time, a plugin causes the error. An easy way to fix this is to rename the directory where the plugin is located and reload your site. In this example, I’ll be renaming the Jetpack plugin.

Now, go to your site and login.

As long as your site is loading, you can consider this solved. You can go back to your plugins directory and delete “jetpack-old” without causing further problems. If you still need Jetpack, simply go through the process necessary to reinstall it.

Thanks for reading! If you have any further issues, please feel free to comment below. I’d be more than happy to expand on this article.

Have a great day!

Leave a Reply