Headers Already Sent

WordPress 2.5 Czech administration

Image via Wikipedia

Headers Already Sent

The most common reasons for seeing this error message in your WordPress site are spaces, new lines, or invisible characters before an opening <!--?php tag or after a closing ?> tag in one of the site’s scripts. But, in order to fix the problem, you have to know which file is causing the problem.

Step 1: Interpreting the Error Message

All of the relevant information is normally given in the first part of the message — the ... output started at... part.

Example 1

Warning: Cannot modify header information - headers already sent by (output started at /path/wp-content/plugins/foobar/foobar.php:8) in /path/wp-comments-post.php on line 55

In this example, the problem is in the foobar.php file of the Foobar plugin.

Example 2

Warning: Cannot modify header information - headers already sent by (output started at /path/wp-content/themes/wibble/functions.php:11) in /path/wp-includes/pluggable.php on line 850

Here, the problem is in functions.php file within the Wibble theme

Example 3

Warning: Cannot modify header information - headers already sent by (output started at /path/blog/wp-config.php:82) in /path/blog/wp-login.php on line 42

The problem is at line 82 of wp-config.php.

Step 2: Fixing the Problem

Example 1: A Plugin

The easiest option here is to simply delete the plugin and look for an alternative one. If you cannot access your WordPress dashboard, reset the plugins folder. Then re-install your plugins — with the exception of the one that caused the problem.

Example 2: The Theme

If you are not comfortable with editing PHP files, then you may want to look at installing another theme. If you cannot access your WordPress dashboard, switch to the default theme by renaming your current theme’s folder in wp-content/themes and adding “-old” to the end of the folder name using FTP or whatever file management application your host provides. This should allow you back into your dashboard where you can download another theme.

If you are comfortable with editing PHP files, then download the file mentioned in the error message (functions.php in the Example 2) and follow the instructions for removing invisible characters in a file.

Example 3: wp-config.php

  1. Download wp-config.php from your site’s main WordPress folder.
  2. Open the file in a plain text editor.
  3. Check that the very first characters are <?php
  4. If the very last characters are ?>, remove them.
  5. Check that there are no invisible characters in the file.
  6. Re-upload the amended file.

Removing Invisible Characters in a File

  1. Open the file in a plain text editor.
  2. Place the cursor before the first character in the file.
  3. Press the BACKSPACE key & keep it pressed for a count of 10.
  4. Place the cursor after the last character in the file.
  5. Now press the DELETE key on your computer & keep it pressed for a count of 10.
  6. Save the file without pressing any other key.
  7. Check the encoding of the file. Do not encode files as UTF-8 with BOM. The BOM will be seen as a character.
  1. GadoEletalo
    November 30, 2011 at 3:22 PM

    Help plz!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: