Fix “Warning: Cannot modify header information” error
This entry was posted by nhc on Monday, July 14th, 2008 at 4:44 pm. It is filed under Wordpress Tutorials and tagged with wordpress error.
Did you encounter this error before when using Wordpress? I did. This morning, I decided to modify and clear some lines of code of Amazing Grace theme to make it lighter and lighter. Everything was fine (as my thought). I uploaded my modified files to ftp, browsed http://themelib.com and BOOOM!!! What’s it !?! An empty page with warning text appeared (looks like the Dead Blue Screen on Windows
)
Warning: Cannot modify header information - headers already sent by (output started at /.../themelib.com/wp-content/themes/Amazing-Grace/functions.php:293) in /.../themelib.com/wp-includes/pluggable.php on line 694
Eh, what I’ve done? I can not remember! This is the time when Google becomes useful
. After searching on internet, I found the solution to this problem so I thought I might as well write an entry, just in case we all encounter this in the future.
Introduction
This error happens when there are one or more spaces before “<?php” and after “?>”


Solution
The only thing you need to do is to clear all spaces before “<?php” and after “?>” and the warning will be gone (never return)
Advance
If the solution above do not solve your problem, this advanced section may useful.
Your .php file should saved under ASCII format. If you saved it under UTF-8 format, make sure the first 3 bytes Byte Order Mark (BOM) is deleted.
You've read the post. What's next?
If you like this post then please consider subscribing to our RSS feed. You can also subscribe by email to receive free updates directly in your inbox.
Want to know what am I doing? Follow me on Twitter!





















it is true that not understand a thing of Wordpress know that more errors so often appear in agreement the template! studying and practicing easy solutions views easy Then good luck
Thanks to you my layout is getting pretty! Check out my blog by clicking on the link that takes my name:) but because of what happened with the skinpress not know if you can still help me, just have to make the imprint on Header become a link
do with that also links the body of posts stand out, is as normal as the default
Success and always!
I just wrote a little this morning on removing BOM from UTF-8 encoding php files whenever dealing with Wordpress themes.
http://www.jasonwoodcock.biz/2.....e-warning/