«

»

Print this Post

Troubleshoot your WordPress Blog

wordpress-logo-stacked-rgbQuite often, I see messages on a message board that something has “suddenly” happened with the poster’s WordPress blog. Their level of concern ranges anywhere from mildly amused to (usually) panicked. In reality, nothing ever happens “all of a sudden”. When pushed or prodded, it usually turns out that the poster had installed a new plugin (or several) or deactivated a plugin, or upgraded plugins, themes, or the WordPress engine itself. You can hardly call that “suddenly”.

In reality, you can also do nothing and suddenly have your blog go wonky. The truth is that you are not the only one working behind the scenes there: your host may be doing some behind-the-scenes upgrades (which is why you never ever ignore an email from your host), or you may have been hacked. You could also have done something 20 minutes ago that caused a problem but that didn’t appear to you until your browser cache expired.

What I am proposing here is a protocol for troubleshooting a WordPress blog that takes into account all of those possibilities. This document will probably never be complete, so feel free to comment and add your own advice, tips, concerns, questions, or links.

Try these things, in roughly this order, until you figure out what the issue is.

Refresh your Browser

Every browser has a cache—a place where they store files temporarily until you call for them again. If you’ve ever hit the “back” button and seen the last page you were on appear almost instantly, you’ve experienced the miracle of the browser cache. The browser didn’t pull those files from the server again; it merely pulled them out of the cache.

Browsers vary in how long they will hold on to files downloaded from the web. Some will hold on to them for a given amount of time, others will limit their cache by size, and once it is full they will start deleting the oldest files.

To pull a new set of files from your server—and not from your cache—press CTRL + F5.

Empty your Browser Cache

Sometimes CTRL + F5 doesn’t work. It should, but it doesn’t. In that case,empty your browser cache. This generally involves going into your browser’s options and emptying it from there. You can find out how to by googling your browser name + “empty cache”.

Empty your Server Cache

WordPress, like many other CMS’s is built in PHP. Browsers can’t interpret PHP files; they can only understand HTML. Every time someone goes to your WordPress site, your server uses those PHP files to generate HTML files, which get sent to your browser.

It takes some memory for your server to generate those HTML files, so to save load on your server, there are a number of plugins that act as caches for those HTML files. In other words, rather than generating fresh HTML files when someone clicks on a page, the plugin first checks the cache to see if those pages have already been created. If so, it sends those to their browser. If not, your server generates those HTML files, keeps a copy in the cache, and sends a copy to their browser.

What this means is that just because you change a PHP file on your server, or change your WordPress or theme settings, your server won’t necessarily send you a fresh copy of the HTML. If you have been working on your site, there are probably a lot of HTML files sitting in the cache, and even though you are refreshing (or even emptying) your browser’s cache, the server is still sending you cached files. The only way to get fresh HTML is to empty the server cache. Instruction usually come with the caching plugin you are using.

I know that sounds a bit technical. That’s because it is. If you are doing a lot of development on your site, it’s best to temporarily turn off your caching plugins until you are finished.

Try Another Browser

Sometimes the problems you encounter are a result of the browser you are using, especially if you are using Internet Explorer. Try a different browser, such as Firefox, Chrome, Opera, or Safari. If your problem goes away, then the browser you are using is the issue. You will need to research to find out if a solution is available and if so, how to implement it.

Try Another User Profile

Sometimes the problem isn’t with your server or your browser, but with the user profile you are using on your local machine. Some people have a tendency to install software somewhat indiscriminately, and one or more of those apps may be causing an issue.

I always have a testing profile on my computer that I don’t install any software on. If I am having a particular problem troubleshooting a website (or even my computer), I switch to that profile because it has a minimum of extra applications. If the issue doesn’t occur under this profile, I know that it’s a local issue with something I’ve installed.

Try Another Computer

If in doubt, try another computer in your household. The trouble may arise from software which automatically gets installed or updated across all user profiles.

Deactivate your Plugins

Most of the issues I’ve seen with WordPress sites arise from plugin conflicts. The easiest way to determine if this is the case is to simply deactivate your plugins, which I’ve written about here.

Try Another ISP

Sometimes issues arise because of your ISP (internet service provider). It’s rare, but it does happen. To rule this out, try visiting your site through another ISP, such as at work, school, the library, or a local restaurant that offers free internet.

Switch to the default 2012 Theme

To rule out any theme related issues, try temporarily switching to the default 2012 theme which comes preinstalled with WordPress. If the issue disappears, it is related to your theme.

Of course, if you have edited the 2012 theme files, you may still have problems. See “Reinstall Your Theme”, next.

Reinstall your Theme

If you have edited your theme files, you may have introduced faulty code or removed something that the theme or WordPress needs to function correctly. Reinstall your theme via FTP to rule this out.

To prevent this from happening in future, always make changes to your site via WordPress and theme options, or by using a child theme.

Ensure your Host Meets WordPress Requirements

Did your site quit working after a recent update? Are you trying to get WordPress up and running for the first time and not having any luck? Make sure your server meets the minimum requirements to run WordPress, which you can read about here.

Set wp_debug to “true”

By default, WordPress does not display most errors. If you are having trouble diagnosing an issue, setting wp_debug to “true” in your config.php file will cause WordPress to display those errors, which will give you more information.

You need FTP access to your site to do this. Here is the official WordPress documentation.

Reinstall WordPress

If in doubt, reinstall WordPress via FTP. It’s probably best to delete all your WordPress core files first, so make a back up of your config.php file and wp-uploads folder first. Download a fresh copy of WordPress here, unzip it,and ftp it to your site.

If Your Site Has Been Hacked

First, stay calm. You can handle this. There are a number of resources to help you:

You should be making backups of your WordPress installation on a regular basis. You can find more information about that here.

Miscellaneous Error Messages

There are a number of error messages that come up frequently enough to warrant discussing them here.

“Fatal error: Allowed memory size…”

If you get an error that looks like this:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes) in…

your PHP engine is running out of memory. The obvious way around this is to allocate more memory to PHP on your server. There are several ways to do this.

  1. If you have access to your php.ini file, find a line that looks like this:
    memory_limit = 32M ;
    and change the value to a higher number. (In this case, “32M” means “32 megabytes”.)
  2. If you don’t have access to your php.ini file, you can try adding this to your .htaccess file:
    php_value memory_limit 64M
  3. You can also try adding this to your WordPress config.php file:
    define('WP_MEMORY_LIMIT', '64M');
  4. If none of those work, try talking to your host. You will need FTP access for options 2 and 3; if you don’t have FTP access to your site, you really need to change hosts.

I offer this advice very reluctantly, as a sudden need for increased memory can sometimes mean that you have a bad plugin or that you have been hacked.

“Warning: Cannot modify header information – headers already sent by…”

You generally see this error after you have modified a php file. PHP is sensitive to spaces or new lines in indiscriminate places. Most php files begin with the opening php tag:

<?php

and end with the closing php tag:

?>

There can be no lines or spaces before the opening php tag, and no lines or spaces after the closing php tag. Additionally, if you are working with a config.php file or a functions.php file (in a child theme, for instance, do not intersperse closing and opening php tags. Use one opening tag at the beginning of the file, and one closing tag and the end of the file.

Additionally, use a text editor such as Notepad++ (WIndows) or eMacs (Linux, OSX) that allows you to easily specify the file encoding, and save the file as “UTF-8 without BOM”. The BOM (byte order mark) is sometimes interpreted as a space.

If you need additional help, see the official WordPress documentation on this issue.

The “Briefly Unavailable for Scheduled Maintenance” Error

Every once in a while, WordPress will get stuck after an upgrade, and all you will see is this:

Maintenance - Mozilla Firefox_2013-08-02_12-24-10When WordPress auto updates, it adds a file called “.maintenance” to the root folder of your WordPress install, which causes the above message. When WordPress is finished updating, it’s supposed to delete the file and everything goes back to normal.

In some instances, however, it fails to delete that file. In this case, the solution is simple: use FTP to navigate to your WordPress root installation, find that file, and delete it.

Still Stuck?

Remember, chances are you are not the first person to experience this problem, and that a solution is probably out there, just waiting for you to find it.

Permanent link to this article: http://blog.kjodle.net/2013/07/04/troubleshoot-your-wordpress-blog/

2 comments

  1. Sanj

    Thank you for the information. It is nice to get them on a single post rather than searching all over WP support database.

    Thanks Ken!

    1. Ken

      You’re welcome. And that’s pretty much what this list is: a distillation of various bits of advice from all over the interwebs. If you can think of other ideas or links to add, please let me know.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Comment moderation is in use. Your comment will appear shortly.