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!

Published
Categorized as WordPress

By Sharon

Hello there! I'm a web developer in Louisville, Kentucky. I started on this career path by purchasing an O’Reilly PHP book from Barnes & Noble in 1999. Since then, my desire to learn as much as I can about web site building and server maintenance has grown. I love technology and what it can do to simplify our lives and make it more interesting all at the same time. Seeing a creative design come to life and bringing it into the web world is my favorite puzzle to solve. My server experience is based around launching WordPress-friendly servers — Linux (Ubuntu and Centos flavors), Apache, MySQL, and PHP. I have worked with various modules, extensions, installs such as ImageMagick, LetsEncrypt, Sass, LESS, and the Homebrew family of extension. My main love has been with PHP, and my CMS of choice has been WordPress since its inception in 2003. I find it flexible, secure, easy to design around, and so customizable. My strengths are in developing from-scratch plugins and themes for the WordPress CMS with a strong background in PHP and MySQL development.

Leave a comment

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