18. Troubleshooting Common WordPress Problems


In This Chapter

How to fix plugins and themes when they break

• Fixing problems with WordPress itself


I hope you don’t ever have to use this chapter. Really. It’s no fun when your website breaks. However, given all its complexity, WordPress doesn’t actually break all that often for most people. Not that WordPress, or any of its pieces and parts, is perfect—it’s just that WordPress seems to be rather forgiving when things go wrong. This chapter won’t, in fact, be very long or very complicated. For the scope of this book, if the easy fixes I can offer don’t work, you’re going to need to call in an expert. The sage advice I can offer here is the equivalent of if you emailed me that your site was having an issue, gave me some basics details, and I email back with suggestions. These are the “my best guess without seeing it” kinds of fixes. It’s a good thing that most of the time that’s all you need.

Fixing Problem Plugins

There is a BBC show called The IT Crowd where the intrepid IT support team answers most calls with, “Have you tried turning it off and back on again?” Yeah, this isn’t just an IT cliché, it really does fix a lot of issues—especially with plugins. It’s mostly the turning off part. If your site is not behaving or is behaving strangely, try disabling the last plugin you installed. If that doesn’t help, disable all the plugins and see how the site works then. Better? Good, then turn your plugins back on one at a time, checking to make sure that things are still working all along the way (go to the home page of your site, refresh, click around). Hopefully, this will narrow down the list of suspects that are causing issues. If you install a plugin and it immediately breaks your site and you can’t get back to the Dashboard to disable it, don’t panic. Just launch your handy FTP program, connect to your site, and navigate to wp-content/plugins/. Find the plugin you just loaded and delete it. You should be able to reload the Dashboard now. When you visit the plugins page within the Dashboard, you’ll see a nasty warning that such and such plugin can’t be found so it has been deactivated, and so on. This is exactly what you want. WordPress might grumble when a plugin disappears, but it usually doesn’t break.

If you have a plugin that was working but has gotten messed up, there are two ways to approach the problem. One, if the plugin has an option or button to reset to default settings, do that. Starting from scratch often helps set things straight. If that doesn’t work, go into the plugins list and delete the plugin. First deactivate the plugin; then click the Delete link. WordPress asks you on the next screen if you really want to delete the files or just go back (Figure 18.1). After you delete the plugin, try reinstalling a new copy from the plugin repository and starting over. It happens; maybe the last update hiccupped at the wrong moment, maybe something else caused the plugin to break. Often, just deleting and reinstalling a plugin fixes a lot of issues.

Image

FIGURE 18.1 Deleting a plugin.

Still not working? Then you are looking at one of several issues that could be going on: two plugins conflicting with each other (like two social sharing plugins, two caching plugins, two SEO plugins) or the plugin isn’t compatible with that version of WordPress. You can maybe find out the latter by looking at the plugin details on the WordPress plugin repository, but often there isn’t enough data to know. In these cases, your best bet is to call in someone who can troubleshoot the issue with you. Good thing the chances of it getting to that point are pretty low.

Untangling WordPress Theme Issues

Themes are a whole other place where things can go sideways (or pear shaped or just plain broken). Unlike plugins, themes are a little trickier to fix. The first step, if your site is looking just wrong (and you’re sure it’s not a plugin issue), is to switch to another theme like Twenty Ten, Eleven, Twelve, or the like. Choose one of the basic, default, works-all-the-time themes. If it’s a new post that looks like it’s causing the issue (sometimes post issues look like theme issues), push it back to draft. After you get your site looking okay in a default theme, switch back to your regular theme and try resetting the settings. Check and disable new widgets. Just start looking at the different theme functions and try setting them back to defaults. Custom CSS? Get rid of it (copy your changes and paste into a text file first so you don’t lose them). If you’re still having problems, delete the theme. You’ll have to switch to another theme before deleting, but after you do that, you can reinstall a fresh copy and try again. While working on this book, I was trying early builds of Twenty Fourteen and I just couldn’t get it to work right. Finally, deleting and reinstalling it fixed everything. Often that’s the simplest way to go.

That brings me to customized themes. If you start customizing a theme—that is, editing the files of the theme and not making a child theme or using Custom CSS, you need to keep a clean, unedited, untouched version of that original theme handy for just these occasions. More than a few times I’ve edited a theme and gotten things so messed up, I had to start over. It happens, so you want to have clean copies handy of themes you work on, just in case.

Fixing a Damaged Database

If you’re having database issues or your database has been corrupted by a hacker, the only thing to tell you is I hope you have backups of the database. Really, I’m sorry that’s the only real option. Most of the time when a database has gone south, the only way to fix it is to find the last good, uncorrupted copy and replace the database with that one. Yes, you might lose posts. Yes, you might have to redo some settings or plugins. But often that’s the only hope. Also, this might not be something you want to take on yourself. Database stuff can be tricky. I’m okay with erasing my database and bringing up an old one from a backup, but really digging in and fixing tables and other problems? Nope, I’d call in favors for that.

Don’t worry if you have to call in an expert to fix your database; sometimes all of us do.

When WordPress Doesn’t Work

What if the site won’t come up at all? You get something like a 500 configuration error. Panic? A little panicking is understandable, but don’t worry, there are ways to start working through the causes and solutions. Here’s a checklist of things to start with:

• Check whether you can get to the Dashboard. If yes, then it’s probably a theme or plugin issue that can be fixed easily (see the section earlier in this chapter).

• Ask a friend to check your site. Sometimes it might be just you.

• Contact your host. Ask them if something is up. Sometimes it’s not even your site that’s having a problem—it’s your host.

So if you can’t get to the Dashboard, your friend says your site is toast, and your host says that it isn’t them, it’s time to step things up.

• FTP into your site and go to wp-content/plugins/. Take a screenshot or write down all your plugins; then delete them all. Yes, all of them.

• Try your site and Dashboard again. Sometimes a single plugin or too many plugins has caused the site to flip out. Usually this is just the kick in the pants it needs to reset itself.

• If you’re using a caching plugin, delete the cache files from wp-content. Try again.

• If that didn’t do it, copy/download your theme down to your computer and delete that, too. WordPress will switch to one of the other themes automatically.

If your site still isn’t working, the next thing to try is a bit of a nuclear option, but it’s nearly the last step before calling in your local WordPress geek to help: deleting WordPress and reloading.

Here’s what you do. First, go to WordPress.org and download the latest version of WordPress. Unzip the file so you can see all the files. Through FTP, delete all the WordPress files except wp-config.php and wp-content. Then upload the files from your computer, making sure you do not upload wp-content; you want to keep that directory. Remember, the only irreplaceable things in WordPress are the things you’ve uploaded and changed. Pretty much that’s what’s in wp-content. Keeping wp-config.php is more of a convenience so you don’t have to reenter your database information. After all that uploading, see if your site is back. Yes, sometimes even WordPress gets corrupted (rarely, but I’ve seen it happen a few times), and deleting all the files and starting fresh can fix things.

At this point, if WordPress and your site aren’t working, you’ve got a bigger problem, something that you’re going to need help fixing.

Help! I’ve Been Hacked!

It happens, even to the best of us. Unfortunately, when people get hacked, they don’t know for a while because the hacks are typically very clever. The common WordPress hacks insert spammy code into your posts and pages for, well, the stuff you see in your spam folder. After doing the obvious thing of changing your WordPress password and all the passwords of the users of the site, you’re going to need to call in an expert. If you’ve been hacked, the fixes are complicated, and you need people who have fixed these problems before to help. If you have the situation where someone has gotten into your site and is publishing and changing things, that’s different. If you’re not locked out of your site, change all the passwords. If you are locked out of your site, ask your host or a geeky friend about resetting passwords right in the database, and then get help locking your site back down again.

What are the best ways to keep from getting hacked? First, keep WordPress, your plugins, and themes updated, and then use good, strong passwords for your site. Don’t use an admin account with the username “admin”. Don’t use the same password you use for other sites. Don’t share your account with other people. One person, one account, and insist on strong passwords for all users who have administrator privileges. Most of keeping from getting hacked is prevention: updates and good passwords.

Conclusion

I hope if you needed to use this chapter that your site is back and working. Just remember, if something goes wrong, don’t panic. If you have backups, you’re probably going to be okay. Even if you don’t have backups, you’ll probably be okay. As long as your WordPress database is intact, you’ll be able to get your site and content back. You might have to redownload a lot of plugins and your themes, but your words will be there. You might lose images, but....

Just remember, don’t panic. Don’t do anything you’re unsure of doing because you think it looks like the right thing. And if you get stuck, call in a friend who is a WordPress expert. There are lots of us around, and sometimes all it will take is some pizza and beer to get things straight.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.151.44