Quite 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 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.
- Refresh your Browser
- Empty your Browser Cache
- Empty your Server Cache
- Try Another Browser
- Try Another User Profile
- Try Another Computer
- Deactivate your Plugins
- Try Another ISP
- Switch to the default WordPress Theme
- Reinstall your Theme
- Ensure your Host Meets WordPress Requirements
- Set wp_debug to “true”
- Reinstall WordPress
- If Your Site Has Been Hacked
- Miscellaneous Error Messages
- Still Stuck?
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 on your computer 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 do this by googling your browser name + “empty cache”:
Empty your Server Cache
WordPress, like many other content management systems, 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 then get sent to their 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. Instructions 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 WordPress Theme
To rule out any theme related issues, try temporarily switching to the default theme which comes preinstalled with WordPress. If the issue disappears, it is related to your theme.
[important]Update: As of WordPress 4.0, the default theme is 2015.[/important]
Of course, if you have edited the default 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.
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. It’s about that simple, but you may want to read the full instructions first.
If Your Site Has Been Hacked
First, remain 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.
- 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”.)
- 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
- You can also try adding this to your WordPress config.php file:
- 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:
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.
Every once in a while, WordPress will get stuck after an upgrade, and all you will see is this:
When 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.
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.
- Try reading the WordPress Troubleshooting FAQ
- Read “I Make Changes and Nothing Happens“.
- Read the WordPress Documentation. (When I talk about the WP Codex, this is the place I’m referring to.)
- Search through the WordPress Support Forums for a similar problem to see what solutions have already been suggested. If, after a thorough search, you can’t find any answers, feel free to start a new thread, but be sure to read the forum rules first.
- Remember that GIYF: Google is Your Friend. Just search for your problem, making sure to add “WordPress” as a search term. For example, searching Google for the “wordpress headers already sent” problem yields almost a million results.