WP Stagecoach has been acquired by the WP Masters! Please visit this page for more information.

How To Troubleshoot Problems on WordPress Sites – with Staging!

When your WordPress site is broken or doesn’t work as expected, finding the source of the problem can be a big headache.  There are lots of great tutorials out there about how to troubleshoot your WordPress site, but if you read through them, you’ll notice a common theme: to find the problems on your site, you often have to break or cripple your site even more.  In this tutorial, I’m going to show you how you can use a staging site to troubleshoot problems on your WordPress site, with minimal impact on your live site.

Why should you care if your live site is impacted?

If your website is already broken, why should you care if you have to break it more to fix the problem?  You want to minimize the impact on your site’s visitors.  You might be troubleshooting something really minor (like maybe you aren’t receiving confirmation emails from your form plugin, or maybe one page has a funky layout), or you might be troubleshooting something much bigger (like images not loading, or pages that don’t work at all), but if even a part of your website is working, you want to leave that up and functional so that visitors to your site can use as much of the site as possible.  The steps you need to take to troubleshoot your site are going to mess with the functionality of your site even more, so you don’t want your site visitors to see the site while you’re troubleshooting.

Step 1: Create a staging site

The first step is to create a staging site.  There are several reasons why creating a staging site is an essential part of troubleshooting:

  1. You can experiment all you want on the staging site without impacting the live site – if you switch themes or disable plugins on the staging site, it won’t affect your site’s visitors.
  2. You won’t risk losing any data – if there is data loss, it will happen on the disposable staging site instead of on the live site.
  3. Sometimes, just creating a staging site helps you find the problem.  There are lots of ways to create a staging site.  Some staging solutions create the staging site on the same web host as your live site.  Some staging solutions (like WP Stagecoach) create the staging site on a separate server, or on your local computer.  Sometimes the staging site won’t have the same problem that the live site has.  If this is the case, then it is likely that there is something about the hosting environment that is causing the problem, and you can contact your web host to get their help figuring out what it is.

Step 2: Update everything

Make sure that WordPress, your theme, and all of your plugins are up to date on the staging site.   This might solve the problem.  If it does, then you can safely run all of the same updates on your live site.

Step 3: Disable all plugins

Here’s where we start breaking the site to find the problem.  Disable all the plugins on your staging site.  If you are trying to troubleshoot a problem with a particular plugin, then leave that plugin active but disable all of the other plugins.  Disabling all plugins can be scary, but don’t worry: for one thing, you’re doing this on a staging site where breaking things doesn’t matter, and for another thing, you won’t lose any of your plugin settings.

After you have disabled all of your plugins, test the staging site to see if the problem has gone away.  If it has, then you know that one of your plugins has caused a problem.  Now, you need to activate your plugins one at a time.  After activating each one, test again for the problem.  As soon as the problem returns, you know which plugin has caused the problem.  You can either stop using that plugin, or contact the plugin’s developer to see if they can fix the problem.

Step 4: Switch to a default theme

If disabling all your plugins doesn’t fix the problem, then switch to one of WordPress’s default themes, such as TwentySixteen or TwentyFifteen. This will totally change how your site looks, but that’s why we’re using a staging site.  If the problem goes away, then you know that the problem was caused by your theme, and you can either use a different theme or contact the theme developer to see if they can fix it.

If the problem persists, go back to Step 3 again: disable all the plugins with the default theme, and see if that solves it.  If so, reactivate the plugins one at a time until you find the culprit.  Then you will need to contact both the plugin developer and your theme developer to let them know that there is a conflict between the two.  Hopefully they will be able to fix the conflict.

Step 5: Turn on debug mode

If you still haven’t found the source of the problem, you can turn on Debug mode. To do that, you will need to use FTP to connect to your staging site.  In the root directory of your WordPress installation, you will see a file called wp-config.php.  Edit that file, and add the following lines to the end of it:

define( 'WP_DEBUG', true );
define( 'SCRIPT_DEBUG', true );

Save the file, and look at your staging site.  With debug mode turned on, you might see error messages on the site, in the dashboard and on the front end of the site.  Deciphering the error messages isn’t always easy, but more often than not, the error message will include the name of the file that caused the error.  You can figure out which plugin directory the file is in, and then either stop using that plugin or report the error to the plugin developer.

These are some basic steps you can take to troubleshoot errors on your WordPress site. Doing these troubleshooting tests on a staging site can save you a lot of headache: you can do anything you need to the staging site, without worrying about breaking your live site or losing any data.

Image source