Error: Headers already sent, /wp-includes/pluggable.php [WordPress]
So, you’re using WordPress and you just spent hours looking for the perfect theme to fit your new hybrid kitten-and-knitting blog. You upload the theme’s files into the appropriate folder, navigate to the themes page in the administrative interface, and click “activate.” So far, so good, right? Later, you notice that anytime you save a page, post, or option, you’re greeted with an error much like the following:
Warning: Cannot modify header information – headers already sent by (output started at /home/user/public_html/ccc/wp-content/themes/broken-theme/includes/theme-options.php:172) in /home/user/public_html/ccc/wp-includes/pluggable.php on line 237
The exact nature of the error and line numbers will vary. The point is, your frilly new theme is broken or there’s a plugin conflict with it. Here’s a funny thing that happened with my situation and I suspect others may benefit from this tip. If you’re receiving these errors, and you’re still logged into your WordPress admin panel, activate a different theme you know works. The real problem begins if you log out.
If you are unable to access any portion of your site, or most importantly, the log in page, you’re going to need to get your hands dirty.
- FTP into your WordPress themes folder, then to the folder for the offending theme (i.e. wp-content/themes/broken-theme).
- Copy everything within that theme’s folder to another folder on the server, or to your hard drive (or just delete if you plan on installing fresh).
- Copy the files from a known-good theme (like the included “classic” or “default”) into the folder you just emptied.
- You should now be able to access your log in page. (www.yourdomain.com/wp-admin/)
You could just leave it as is and set out to fix or replace your bunk theme, however, I recommend “officially” activating the theme you wish to revert back to, then deleting the duplicate you created in step 3.
WordPress Stats Showing “Dummy” Image

Something went wrong...
Upon viewing your blog stats generated by the WordPress Stats plugin you see an image that looks like a bar graph with data back to 2003 with two colors, one representing “Region A” and the other, “Region B,” you’re looking at a dummy image that WordPress Stats inserts when something goes awry. (Personally, I think it would be better if something more descriptive was there, like an image that says “i is BROKDED!”) I wish I would had the foresight to take a screen shot of the image before I fixed the problem, but at any rate, the problem is resolved.
My solution (thank God, the easy one): Deactive the plugin, delete all related files, upload a fresh copy, and reactivate. You will have to re-enter your WordPress.com API key, and to keep your stats, choose to “Replace” the blog (the plugin will guide you through these steps) with the same URL that you’re reactivating.
If that doesn’t take care of the issue, there are other solutions in this thread.
Good luck!
Something I Probably Should Have Thought About [Gmail Pictures]
This is actually pretty stupid of me to do this, but I have to laugh at it. At the end of January, I was forwarded some information I was expected to post on a web site I administer. After sitting on it for awhile, I simply copied the information from the email, and pasted it into the WordPress visual editor. The email contained a photo which, to my surprise, appeared in the post perfectly formatted. Apparently, I thought nothing of this.
Today, I went back to edit the page because I noticed a typo. Often, when you go to edit a page or post in WordPress, the HTML of the content will appear briefly before the TinyMCE visual editor has a chance to load. So, during that half-second, something in the code caught my eye; something about the image. I checked it out, and it seemed that all this time, the photo was being called from mail.google.com. I thought that couldn’t be right; Google isn’t going to play photo host through their Gmail system. But, the picture was there in the editor and the live page. But, wait a minute… I loaded the page in Internet Explorer (I had been using Firefox), and the image was broken. The problem? Whenever I edited or visited the page, I was also logged into Gmail with the same account that the image came from, so the image loaded because Firefox was authenticated while Internet Explorer wouldn’t be.
I should have known better. When you copy and paste stuff on the web (like web-based email), your browser is actually copying the code behind the content you’ve selected. If the image had already come from another web site like Flickr or Picasa, it wouldn’t have been a problem. But, anyway… another day, another lesson learned.
A Slick Automatic Random Image Rotator Script [Random Picture]
I’ve had this post in the drafts bin for awhile now, I’m just going to finish off it’s miserable existence and push it out into the cold, untamed wilderness of the Internets.
Matt Mullenweg, (of Automattic and WordPress fame), wrote a random image script that fixed a problem I was having building a site about a year ago. The wonderful trick with his random method is that it calls a PHP file which then serves the image by manually writing the file headers to make the browser think it’s calling up an image. This is especially helpful when trying to achieve an image rotation in conjunction with a CSS layout. Normally, random image scripts will place a random image tag (rather, a random value for img=)in the page with a specified image file from a list when the page is parsed. But, if you’re using CSS to serve the images (say, as a background, or header), then that won’t work in CSS since the browser/server is not parsing CSS, but merely reading. So, what this script does is allow you to put a reference to a single PHP file in the CSS (or anywhere else). It’s, then, that PHP file that selects the random image and serves it up to the browser.
The best part about this script is that you can drop a new image in the specified directory, and it’s automatically included in the mix! No need to edit the script every time!
One problem I found, though, is because the CSS makes a call to a PHP file, the browser will call up the cached version of that file until expiration, or forced refresh. (This doesn’t seem to be a problem if the call is being made from another PHP, HTML – or otherwise- file) Since, the PHP file never changes (according to the browser) it’ll likely not be as “random” as you’d like. The result is the same image loading over and over. To overcome this, I added a few lines to the PHP file to include the file header of the image that’s returned to the browser:
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
Now, hopefully, the browser will not cache the file at all. But, if it does, the expiration date is set to July 26, 1997. So, the next time the browser loads the page, since the file seems horribly out-of-date, it’ll load the file again.
Below, I will list the code I have deployed on a live site where it works quite wonderfully. Though, now that I go back and look at it… it’s not very similar to Matt’s script. Huh… I told you this was an oldie. I’m not sure where I got this script, or if I modified it that heavily, but at any rate, here are two random image scripts that work similarly. Perhaps at some point I’ll merge the two different scripts because it seems that Matt’s version is more up-to-date, and uses the more “random” and lightweight “mt_rand” PHP operation.
Script I’m using:
// Modify the following line before using this script
$folder = ".";
$fileList = array();
$handle = opendir($folder);
while (false !== ($file = readdir($handle) ) ) {
if ( substr($file, -4) == ".gif" || substr($file, -4) == ".jpg" ) {
$fileList[count($fileList)] = $file;
}
}
closedir($handle);
$randNum = rand( 0, (sizeOf($fileList) -1) );
if ( substr($fileList[$randNum], -4) == ".gif" ) {
header ("Content-type: image/gif");
} elseif ( substr($fileList[$randNum], -4) == ".jpg" ) {
header ("Content-type: image/jpeg");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
}
readfile($fileList[$randNum]);
?>
To use, just make a call to the php file like you would any image either in a PHP/HTML/CSS/what-have-you page.
(Photo by David Asch)
Update to WiFi Map & Other Updates
I’ve made a sizable update to the WiFi Scan / Wardriving map adding nearly 1000 new points to the map from areas in Southern California. Though, for some reason, the new points are not showing on the web maps, but show when the KML file is loaded directly into Google Earth. I would figure out what the problem is, but, meh.
Secondly… I think I was going to say something about how I’m really digging WordPress 2.7 and its built-in plugin updating and auto-install features. So yeah, I really like WP 2.7′s plugin updating and auto install feature.
Third, I’ve recently become engaged. I guess others would use that as an excuse as to why they are spending less time with online endevours. I’m not. I haven’t spent too much time on this site before the engagement, so, no excuses from me you will hear. However, you will be delighted (but probably “meh”) to know that I have not spared my engagement from the nuances of nerdom. I am currently building a site to centralize wedding details, photos, and house a blog where my dearest and I will share our adventures with family and friends. The site will also have a method to accept RSVPs from guests. I thought that idea would get shot down right quick, because it’s “not how it’s done.” But, to my surprise, she was excited about the prospect of saving the postage by not sending return cards to our tech-savvy friends and family (the techno-phobic will still get the tradtional reply cards).
So anywho, that’s some of what’s going on over here. How about over there?
WordPress.org Downtime [Goshdarnit!]
I’ll admit it, I panicked for a few minutes when I discovered this:
WordPress.org was down!!
I was consoled momentatily by reading the snappy prose, but after a minuted when I refreshed, I was greeted by the same page.
Darkness sets in.
I refresh, again.
It’s getting cold.
F5.
Can’t. Breathe.
F5.
Oh! There it is!
[EDIT 18:50 PDT] WordPress.org is down again.
[EDIT 18:54 PDT] It’s back up, but s l o w.
[EDIT 18:56 PDT] Down.
[EDIT 18:57 PDT] Up? The main WordPress.org site is available. But I’m having trouble accessing the Forums.
[EDIT 18:58 PDT] It’s all up now…?
[EDIT 19:00 PDT] Some’s up, some’s down. I’m really not this obsessed… This is my last edit.
WordPress 2.5.1 is Available, and the Reminders are PERSISTENT
I’m subscribed to the official WordPress blog so I know when new updates are released, however, it seems with the 2.5 landmark release, notification of the update appears on every page of the admin interface. There’s no way you can miss it now. Now, we just gotta get automatic upgrades without having to upload and overwriting files manually.
Anywho, 2.5.1 is out and it addresses a bunch of problems people have been having with the coveted 2.5 release. It looks like a 2.5 “redo” release. After browsing through the WordPress forums, version 2.5 has frustrated many a WordPress user, even veterans. I’ve been lucky, I guess, I have yet to come across anything buggy.



