Print This Post Chad A. Johnson

The “Cannot modify header information…” Wordpress Error

By Chad A. Johnson · July 27, 2009


You are working away at building your Wordpress website. Having fun finding plugins to add exciting new functionality to your site when error messages start appearing at the top of the Wordpress admin.

The error message starts with (1) “Warning: Cannot modify header information – headers already sent by…”, followed by (2) a reference to a plugin file and (3) a reference to “pluggable.php on line 850”.

Cannot Modify Header in Wordpress

This error can seem like a bunch of gibberish, but once you know what you are looking for, it is quite easy to fix.

The Source of the Error

Spaces After PHP CloseWhat has happened is that a PHP file in a plugin folder has picked up an extra line or two after the closing PHP tag. Sounds complex, but it isn’t.

Basically, Wordpress doesn’t want to see any extra lines after the “?>”. The page should end immediately afterward. Doesn’t seem like a big detail, but coding is about little details.

Finding the Guilty Plugin

Section (2) in the above diagram tells you the plugin with the frivolous carriage returns.

You will recognize the “/wp-content/plugins/” as the folder that you uploaded your plugins into. After that is the name of the plugin folder with the corrupt file. In this example, it is WP-Print (an excellent way to add printer friendly pages to your website).

The Fix

The easiest fix is to download a fresh copy of the plugin and replace it for the old folder.

If you have customized the plugin, replacing the entire folder may mean losing your modifications. In that case:

  • Find the file identified in section (2) of our diagram. In the example, that would be wp-print.php in the wp-print folder.
  • Open that file in the Wordpress plugin editor or your favorite code editor.
  • Place your cursor right after the “?>” at the bottom of the file and hit the delete key on your keyboard until no additional spaces remain.

 

Share or Save

  • del.icio.us
  • StumbleUpon
  • Digg
  • Facebook
  • Twitter
If you enjoyed this post, make sure you subscribe to our RSS feed!

Related Posts


Comments

2 Responses to “The “Cannot modify header information…” Wordpress Error”
  1. Chris says:

    Thanks Chad! I’ve been getting those errors in a couple of little websites I have. Now I know what the heck is going on.

  2. Tim says:

    Just wanted to say thank you. Can’t believe something so simple could cause so much grief!

Share your thoughts...

If you want an avatar or to include your social profiles join our Facebook community. You can also edit your profile and add your favorite networks.



« Back to text comment
Bottom