Troubleshooting Your WordPress Website

troubleshoot troubleshooting wordpress website searchIn an ideal world, your WordPress theme and all of its plugins would work in perfect harmony straight out of the box. While things frequently do work that way, sometimes they go awry. That’s when you have to put on your detective cap and start troubleshooting.

A WordPress site can need debugging for many reasons. The site might be running slowly, displaying an error message, or acting quirky. Perhaps most annoying of all is the “white screen of death,” which can happen to the site as a whole or just a particular portion of it.

If any of these things happen to you, don’t panic. There’s a good chance your site can be repaired in fairly short order with a little troubleshooting. This article provides tips to help get your site up and running properly.

While some of these tips don’t require much technical skill, others do. Remember, if you need help with the more technical stuff, TechTe.am is always available to help.

Plans & Pricing

Before you follow any of these tips, make sure you have a recent backup of your site.

Tip #1: Disable plugins

If your site was functioning perfectly and things suddenly went south with no warning, it’s possible a new plugin or plugin update is the culprit. This is usually the easiest place to start troubleshooting. Especially if you know you just added or updated a plugin, start by disabling it and see if the problem goes away.

If you can make the problem come and go by turning the new plugin on and off, try removing the plugin entirely and re-installing it. Failing that, you’ll need to contact the plugin’s developer or choose a different plugin.

When you can’t pinpoint which plugin might be causing issues, disable them all. Then re-enable one at a time. If the problem recurs along the way, you’ll know which plugin is causing it.

Even if you’re unable to access your administration panel, you can deactivate all plugins through FTP. To do so, log into your site via FTP and find the wp-content/plugins folder. Rename the plugins folder to plugins-old. This will deactivate all of your plugins.

Tip #2: Replace current theme with default theme

If disabling plugins doesn’t help pinpoint and resolve the problem, the issue may lie in your site’s theme files. This is especially likely if you’ve just activated a new theme or installed a new site. The easiest way to determine this is to log in to the administration panel and switch your site to one of the default themes, such as the Twenty Sixteen theme.

If you can’t access the administration panel, then you can make this fix via FTP. Log into your site with FTP and find the content/themes folder. It will contain subfolders for each installed theme. Look for the name of the theme you’re currently using and rename that folder. Appending -old to the name will do the trick.

Once you’ve renamed the folder, go to your administrator dashboard and click on the “Appearance” link. You will see a message that says the system is reverting to the default theme because the active theme is broken. Your site will now be running use the default theme, such as Twenty Sixteen. If the problem you were investigating has vanished, you now know it’s theme related.

Tip #3: Turn on WP_DEBUG

WP_DEBUG is a global variable that can be used to turn on WordPress troubleshooting mode. When enabled, PHP errors, notices, and warnings will be displayed on the front-end of your site. You can use these messages to help you track down problems.

WP_DEBUG is off by default, but you can turn it on by finding the following line to your site’s wp-config.php file:

define('WP_DEBUG', false);

then changing false to true.

When you’re done troubleshooting, be sure to set it back to false

Don’t panic if this results in a slew of warning notices scrolling across your screen. As mentioned, this shows all PHP errors, notices, and warnings, not just critical ones. Even notices, however, can provide clues.

Tip #4: Turn on WP_DEBUG_LOG

When WP_DEBUG is on, you can also direct the system to log errors to a file as they occur. By default this feature is disabled, but you can turn it on by adding the following to wp-config.php:

define('WP_DEBUG_LOG', true);

This will cause errors to be saved to the debug.log file in the wp-content directory.

Tip #5: Showing or Hiding Errors with WP_DEBUG_DISPLAY

WP_DEBUG_DISPLAY controls whether error messages are displayed to the screen when WP_DEBUG is enabled. By default, it’s on, and errors will be shown. If you want to hide error messages (perhaps to write them to a file instead), add the following line to wp-config.php:

define('WP_DEBUG_DISPLAY', false);

To restore screen display of error messages:

define('WP_DEBUG_DISPLAY', true);

This control only has an effect when WP_DEBUG is enabled. Setting WP_DEBUG to false also disables screen display of errors.

Tip #6: Logging Database Queries

If a screen isn’t displaying the articles or items you expect it to, or it’s taking a very long time, the problem may lie in a database query. Enabling SAVEQUERIES will save information about database queries to an array, which you can display. Details recorded include the query itself, how long it took to execute, and the name of the function that called it.

To turn on SAVEQUERIES functionality, add the following to wp-config.php:

define( 'SAVEQUERIES', true );

To see the information that’s been saved, you’ll need to modify your theme template to display it to the screen, like this:

if ( current_user_can( ‘administrator’) ) {
global $wpdb;
print_r( $wpdp->queries );
}

Turning on SAVEQUERIES can slow down your site’s performance, so be sure to turn it back off again.

Debugging a WordPress site can get tricky, especially if you aren’t familiar dealing with code. If you don’t want to handle it on your own, we at TechTe.am would love to help. Choose a plan and get started today.