//

Troubleshot: Warning: Cannot modify header information – headers already sent by (output started at… [WORDPRESS]

by dave on May 8, 2010



Most often we are trapped at WordPress with a plethora of errors and mind you they all pop up just because of us making some change in a file or some plugin making some change. A point in case here is an error at WordPress that one may experience often (not that often though :) .

Warning: Cannot modify header information - headers already sent by (output started at /home/.../wp-setting.php:3) in /home/.../wp-login.php on line 314

This is commonly referred as “White Space Problem”. Note that file name and line number may vary and the path too. But the error indicates itself that where is the problem. The error, here is that php code is now coupled with an empty space before or after with blanks (spaces) and/or empty lines at the beginning or end of a file when you edited it or some plugin or your command from SSH has tried to edit a php file. This empty or whitespace is then sent to the browser when the file is loaded and interferes with the header of a page often causing problems with login at wp-admin or wp-login.

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

  1. Carefully look at the file which you have to fix. This is told by the error itself. See within the brackets. (output started at /home/.../wp-setting.php:3). It means error is at line number 3 in wp-setting.php.
  2. Now, edit wp-setting.php or whatever is the file mentioned in the brackets in your error. I always edit it via CuteFTP. You can use any of your program or host provided interface.
  3. Remove all blank spaces before “<?php” and after “?>” whatever is the case.
  4. Save your PHP and upload it again.
  5. Hey, you have fixed it! Send us a comment if you really did :)

Tell us if it worked for you??

Related Articles:

  1. WordPress Fatal error: Cannot redeclare wp_load_image() (previously declared in…
  2. iPad 2 Production has been Started
  3. How To Add Favicon In WordPress Coding
  4. Top WordPress Plugins of 2011
  5. How to add Statpress Plugin (Daniele Lippi) in WordPress Blog
  6. WordPress Fatal error: Call to undefined function _deep_replace()…pluggable.php on line 884

{ 9 comments… read them below or add one }

Tony July 17, 2010 at 12:15 am

didn’t work.

Error is

Warning: Cannot modify header information – headers already sent by (output started at /home/fleming/public_html/agakhan2/wp-content/themes/thesis_17/custom/custom_functions.php:1) in /home/fleming/public_html/agakhan2/wp-includes/pluggable.php on line 868

the custom_functions.php file has only 250 lines. The pluggable.php has something to do with headers on line 868 but no blank lines. Line 868 is

header(“Location: $location”, true, $status);

neither has blank space before <?php

Reply

Dean Ford January 29, 2011 at 2:51 am

The error was in ‘custom_functions.php
line 1.
I thought I had a similar error until I reread the tips. File path and line error is in parens.

Reply

AlanP July 28, 2010 at 2:35 pm

It did not work for me either but I did find a way to avoid the bug by not calling the header function. I made a javascipt call instead:

$url = get_permalink();
$location = “window.location=’” . $url . “‘”;
echo $location;

Reply

waqas August 4, 2010 at 4:19 am

Works for me thanks

Reply

Al Stevens October 5, 2010 at 12:06 pm

It worked! Thanks :)

Reply

kaare smith November 4, 2010 at 9:26 am

Worked like a charm! Thx!

Reply

bhavesh January 27, 2011 at 6:43 am

this post is very helpful to me….

Reply

Dean Ford January 29, 2011 at 2:47 am

Thanks, Nailed it… second time. Nut until I installed my theme, tried to trouble shoot some plug-ins. Remade my child theme and then made the same error in the functions.php file with a few extra spaces. Aargh.

Thanks for the help. Excellent details.

Reply

wparena April 4, 2011 at 8:30 am

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

Reply

Leave a Comment

Previous post:

Next post: