Good WordPress Gone Bad – How To Troubleshoot WordPress When Things Go Wrong

We’ve all been there. Your finger is on the mouse, ready to click, but you pause. You think to yourself,

“Will this click be the one that I regret? The one that can’t be undone?”

This thought comes to mind for good reason. Sometimes when you are working away, suddenly, out of nowhere an error comes up on your screen. Frustrated and confused you think, “Great, now what do I do?”

WordPress is an amazing platform that offers a lot of flexibility and control, but with that flexibility comes more complex problems. Many people who are unfamiliar with WordPress are often afraid of making a mistake. Fear and apprehension are common emotions when your WordPress site has a problem. Knowing how to solve a few of the most common problems can give beginners the confidence to use WordPress without anxiety.

Today, I had the opportunity to give a talk on how to troubleshoot WordPress at WordCamp Milwaukee. Below are the slides from the talk.

WordPress Bliss To WordPress Horror

Most days working in WordPress is a wonderful experience. The platform is easy to learn and provides you with an amazing website. It is like spending a day in a beautiful meadow, or relaxing in a field of clover. It’s all rainbows, sunshine, and happiness. Your site looks amazing and you have awesome content that your audience loves.

Then, all of a sudden out of nowhere BOOM. Something goes wrong on your site, and your beautiful site is transformed into what looks like the fallout from a nuclear zombie apocalypse. Your site doesn’t even resemble what it once was, or worse, it only shows an error message.

What Do You Do Now?

Your site is all messed up, what do you do now? Run away? Get angry? No! You need a strategy. It is important to be prepared in advance. Problems will happen, but if you have a clear plan on how to recover from them you can recover confidently and quickly. Knowing how to solve some of the most common problems, and knowing where to get help when you need it are key to getting your site back in working order.

You Need A Backup Strategy

Many WordPress users don’t realize the importance of having a backup strategy. A backup strategy helps you to protect your hard work and investment. You have spent countless hours or a lot of money getting your site to where it is today. Most likely you invested both time and money. A good backup strategy will help you protect your investment.

Did you know that many website hosting providers do not offer any sort of backup?

That’s right, they leave it up to you. You’ll want to check with your hosting provider to see what kind of backup they offer. A more fully featured hosting company will offer daily backups of your website that you can request to have restored at anytime. Other hosting companies will create backups, but they are only for the hosting company’s use. The backups are only for times when the server you are on has a problem. They will use their backup to bring your site back after fixing the problem. If you run into a problem that wasn’t caused by the hosting provider they may not be willing to restore the backup for you.

No matter if your hosting provider offers a backup or not. It is a good idea to use a backup plugin to back up your site. A backup plugin that backs up your site regularly will allow you to quickly restore your site when something goes wrong. You aren’t dependent on your hosting provider to do a restore. The more control you have over your site the more options you have when something goes wrong. Also, the more backups you have the better. If the hosting provider’s backup fails for some reason you still have your own backup and vice versa.

Upgrades Can Go Wrong

Software updates to your WordPress site can sometimes cause problems. The core WordPress software usually is not a problem. Changes to the core WordPress are rigorously tested before being released. Most bugs are caught and fixed during that testing phase. Once in a while something does slip through, but with so many sites running WordPress anything that does slip through is found and fixed quickly.

More commonly it is a plugin or theme causing the problem. Plugins and themes are tested but the testing isn’t as thorough. It really comes down to the creator of the plugin or theme. Some plugins and themes are created by companies with teams of people, but more commonly they are built by a small team or an individual. The resources just aren’t there to do as much testing. As a result there is a greater chance a bug will get through.

Sometimes one plugin or theme can conflict with another plugin or theme creating a recipe for disaster. With thousands of plugins available for use it is impossible to test all the combinations.

It is also possible that a plugin or theme uses a feature of WordPress that is no longer available. WordPress is in constant change and in order to make WordPress better sometimes old features need to be removed. These decisions are not made lightly and are announced in advance so developers have time to react. With limited resources sometimes it just isn’t possible to have a fix on time.

If you have a backup, restoring your site back to before the updates were installed will get you back in business so your site is functional while you contact the plugin/theme developer to find out how to fix the problem.

People Make Mistakes

I have done it and you probably have too. Humans make mistakes. Maybe you deleted some content by mistake. Maybe you made some change but, don’t even know what you did. One time I accidentally deleted over 1,000 photos from a site in one click. It can happen. Having a backup will make these kinds of mistakes no big deal. You just restore your backup and you are on your way.

You’ve Been Hacked

WordPress is used to run more websites than any other CMS (content management system) on the web. This makes it a big target for hackers. Every minute of every day computers are trying to hack into WordPress sites around the world. I can pretty much guarantee your site has been under attack at one point or another.

If a hacker gets in who knows what they will do. The average WordPress site has at least 1,300 files. It can be very tricky to find what files have been changed and if the hacker has hidden any new files somewhere. Hackers can hide all kinds of stuff in your database too. Having a backup allows you to take your site back to the time before the hackers got in. Then, you can change passwords, and harden your site to prevent it from being hacked again. Without a backup you may never know if your site is clean. Also, there are some great services like Sucuri who can help clean up your site if you have been hacked. That’s a topic for another day.

What Is A Good Backup Strategy?

A good backup strategy includes an automatic backup. You don’t want to have to remember to go through a ten step process to back up your site. Even having to click one button to backup your site is not a good strategy. You will forget or become too busy to do it. The backups you have will be inconsistent at best. That’s why it is important to use a backup tool that will automatically back up your site on a regular basis.

The frequency of your backup depends on how frequently you add content and change your website. A good rule of thumb is to have a daily backup. If you update your site more frequently you might want several backups every day. Just ask yourself, “If I loose one day of work on my site, how bad would that be?” For most people loosing one day of work would be frustrating, but not too difficult to recreate. Comparing that to no backup, or an inconsistent backup, you could loose weeks, months or even years of work. Just thinking about loosing months or years of work makes me feel sick.

Remote Backups

A common mistake is to store your backups on the server that runs your website. If your backups are only on the server your website runs on you are opening yourself to unnecessary risk. If something happens to that server and your website is lost changes are pretty good your backups will be lost too. Be sure that a copy of your backups are saved on another server somewhere. Most backup plugins allow you to have a copy of your backup sent to another server or another service such a Goole Drive or Dropbox. Be sure to enable remote storage when setting up your backup plugin.

What Should I Back Up?

Your website is made up of files and a database. Many people don’t always realize there is a database. Be sure that you are backing up both your files and your database. In order to support more complex backup strategies backup plugins sometimes allow you to backup just your files or just your database. Make sure that you back up both your files and your database. You need both to have a fully functional site.

Test The Backup

Configuring the backup plugin and hoping that it works is not enough. You need to test the backup. Usually the backup is contained in a zip file. Download one of the backups and unzip it. Take a look and make sure you see files and a database backup file. The database backup is usually one file that has .sql at the end.

Do a test restore of your backup. If you have a way to run a WordPress site on your computer restore your backup on your computer. If you have a test or staging environment on a server restore the backup there. You want to be sure the backup is being created correctly. Also, do a test restore on your site. That way you know the exact steps to restore your site when a problem happens. Even small problems can cause a little bit of panic and if you know the steps in advance to do the restore the panic of the situation won’t get the best of you.

Backup Plugins

There are a lot of backup plugins available for WordPress. Two that stand out to me the most are Backup Buddy and UpdraftPlus. Backup Buddy is a paid plugin and UpdraftPlus is a free one. If you can swing the cost of Backup Buddy, which comes down to only a few bucks a month it is well worth it. Your payment gives you access to support and a better guarantee that the plugin will work. UpdraftPlus has been around for a while, but since it is free they don’t owe you anything. They could decide tomorrow to discontinue the plugin and leave you hanging. They probably won’t close up tomorrow, but paying for a backup plugin provides, a helping hand, some additional insurance, and peace of mind.

Revision History

This little known feature will hopefully help you out of a bind someday. I know it has helped me a few times. Revision history allows you to see the changes that have been made to a post or page over time. Whenever you click publish or update a copy of the page/post is saved in the database. You can then view each version and compare the differences between two different versions. This is perfect for those moments when the content editor doesn’t behave the way you thought it would. You can see exactly what it changed in order to fix it.

Not only can you see what has changed, but you can undo changes by restoring an old version of your page or post. Did you make a number of changes to a page today and you decide you don’t like how it turned out? No problem! Just restore the page back to yesterday’s version. Do you wish your page was exactly how it was two weeks ago? No problem! Just restore it back to the version from two weeks ago. Unless you delete out old revision history all of the changes you make to a page or post are saved forever. Sometimes keeping a ton of revisions can cause your site to run slow, but it takes a LOT of content usually to get to that point. Having the history can be valuable. Keep as much of it as you can.

Watch the video below to see how to restore pages and posts back to old versions with revision history.

How To Solve Common WordPress Errors

Here are a few of the most common WordPress errors, and ways to fix them.

Error Establishing A Database Connection

This error happens when the WordPress code isn’t able to access the database. There are a few reasons this could happen, but the most common has to do with the database login information. Just like you have a username and password to log into to WordPress the WordPress code has a special username and password it uses to log into the database. If the login information in the WordPress settings file is incorrect you will get this error.

In order to fix this error you’ll need access to your web hosting control panel. To see how to fix this error watch the video below:

You might also see, “Error Establishing A Database Connection” if your hosting provider is having a problem. Server issues could prevent your website from connecting to the database. Another possibility is that your database is corrupt. Performing a repair on your database might fix the corruption. Otherwise, you’ll have to restore from a backup to get your site working again.

Internal Server Error

The most common cause of an “Internal Server Error” is a problem with the .htaccess file. WordPress generates this file for you automatically and will sometimes update it when you modify WordPress settings. Some plugins also modify the .htaccess file. On rare occasions the settings entered into the .htaccess file by one plugin can conflict with the settings from another. These conflicts can, also, cause an “internal server error.”

Luckily fixing the .htaccess file is super simple. You just delete the file and instruct WordPress to recreate the .htaccess file again. Watch the video below to see the steps to delete and regenerate the .htaccess file:

If deleting and recreating the .htaccess file doesn’t solve the problem you are most likely facing a theme or plugin problem. We’ll cover what to do about theme and plugin problems in the next section.

The WordPress White Screen of Death

Out of all the WordPress errors this one probably was the most frustrating for me the first time I saw it. How do you Google a blank white screen?

This error is most commonly caused by a problem with a plugin or theme. The problem can be caused by a bug in a plugin or a theme. It is common for two plugins to conflict with each other. With thousands of plugins out there it is impossible to test every combination of plugins.

The strategy for getting your site working again is to figure out exactly which plugin or theme is the problem. To do this you want to disable each plugin one by one to see which one is the problem. Watch the video below for detailed steps on how to get rid of the white screen of death.

Other Errors

You might find that your site looks “broken” or you will see error messages printed out on your site. Most of these errors and many others can be solved by following the same steps.

Disable each plugin one by one until the error goes away.

Switch your theme to one of the themes that comes with WordPress. These are the “twenty something” themes such as twenty fifteen, twenty fourteen, etc.

Update WordPress, all of your plugins, and your theme to the latest version.

If the above steps don’t solve the problem you’ll need to contact the plugin or theme creator. They might even have a solution on their website already. If that doesn’t work Google the error. Chances are someone else already had this problem and came up with a fix. The WordPress Support Forums are extremely helpful. I often find that my question is already answered in the forums. If your question hasn’t been answered post it and you will get help in no time. If all else fails contact your favorite WordPress expert for help.

Keep It In Perspective

Things will go wrong, but having some familiarity with common errors and having a plan for recovering from problems can help you get things fixed quickly. Think of every problem as a learning experience. Each time you conquer a problem you have a new tool in your troubleshooting toolbox that will only help you in the future. The vast majority of your days with WordPress will be smooth. Enjoy your WordPress journey.

About the author

Damon Schopen designs and develops web-based software. He specializes in e-commerce, interactive websites, integrating software to allow sharing of data across systems, and customizing existing software applications to meet your specific needs. For the past 10 years Damon has helped a variety of companies develop the web-based software they need to do business with their customers.