• Become a Shouter : Join here
  • X

    WordPress 2.9 Upgrade-Header Cannot Be Modified Error

    By in WordPress

    Haven’t slept from last evening,know why? Exams got over and was prepared to do some real blogging.

    But then I am not as lucky as you or may be you are not as lucky as me, Because I have had a real tough night searching for solution of one thing and that is what I am going to tell you about.

    Before I begin let me make it clear the points that I  stress upon are real worth as if I WOULD have followed them,would have been seeping tightly now (Of course with Mr Furhead(My Rat)

    Things to do before you upgrade to wordpress 2.9

    1. Make a complete backup of your data base(I know it takes time and bandwidth,but then why take chances to repent later)
    2. If you are using Thesis then you surely need to make a full backup of it as well.
    3. Never ever use note pad to edit any Php codes(You will come to know in a moment what it does to your Php codes)

    So you upgraded have  to wordpress and voila everything went fine and that’s it-If you fall in to this list of folks then  please do keep visiting this blog or simply bookmark this page as who knows when you may need these tips about wordpress warning messages.

    And if you are from the few lucky champs who are getting these error’s

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

    The file names (highlighted) may be different but the real culprit in this case is notepad and the error lies in your functions.php file or any file that you have edited in a note pad.

    You may even not be able to login to your wordpress blog,so make sure you have a ftp client(such as fire ftp for Mozilla Firefox) or a cpanelenabled hosting.

    Note:-As I Know how these error crept into my php files I have deliberately reproduced them by simlply editing these files in note pad.

    Here are a couple of screen shots of a view at php(after being edited in notepad) in note and stlyemaster(Now my only coding software)

    Notepad view

    Don't use notepad to edit php codes

    see the pink arrow-No bad codes visible

    Stylemaster View

    Stylemaster and php editing

    Stylemater shows the hidden bad codes

    As you can see these the code in the first line is visible only in stylemaster and not in notepad.

    This is where I Was caught and was getting agitated.

    Now here are some way’s to get rid of these wordpress errors and warnings that I know of:-

    1. Open your function.php file in a reliable coding software and remove the hidden codes as shown in the picture above.(Worked for me)
    2. Open you wp-config.php file ( located in your wordpress root directory) and remove all the spaces before php tags.

    What I Mean to say here is remove any spaces including any blank lines,just press delete till you reach the opening or closing php tags.

    Wordpress header cannot be changed warning

    Leave NO Blank spaces before <? php

    Php warnings and errors in wordpress

    Leave NO space or blank lines after ?> code

    Perhaps there may be many more methods to deal with this wordpress problem but these two are the only ones that don’t ask you to mess up your php codes.

    After you follow these steps you may get another error from your wordpress blog,simply check the name of the first file again and remove the crap out of their.

    Here I am telling you again do not use note pad to edit your .php files.

    Hope this helps you and in case none of these work for you(I am sure that first one works like a charm) then please take note the of first file mentioned in the error/warning and just open it in your code editing software(not notepad)..

    Subscribe Updates, Its FREE!

    Article by

    Shoaib has written 10 articles.

    If you like This post, you can follow ShoutMeLoud on Twitter. Subscribe to ShoutMeLoud feed via RSS or EMAIL to receive instant updates.

    { 10 comments… read them below or add one }

    SmashinGeeks

    Oh this was the error , thanks for the tutorial . Now my localhost blog is working properly.

    Reply

    Chethan

    Wordpress People are So Sick! Why did They Upgrade to Such a Bad Version of Wordpress… where there are hundreds of Bugs?? I was satisfied with v2.8!

    Reply

    Ashfame

    Bugs always creep in. And people upgrade because they want more & more features. Its their choice to upgrade or run a older version. I hope by WordPress People you mean the end users and not the developers.

    Reply

    shoaib

    As i told in the post as well,that its totally a fault of your editor,so please do not blame the WP guys,they are working on a rocket science…..

    Reply

    Ashfame

    Actually you just need to make sure that there is no space before `<?php` and the last ending tag can be even left out as there is some uncertainity in debate that it actually gives some sort of performance gain.

    Reply

    Athul Jayaram

    Great Effort Harsh. Thanks for that stylemaster. I am going to use that as my default editor

    Reply

    Ashfame

    Try Notepad++

    Reply

    shoaib

    yeah Notepad++ is nice as well ,haven’t used it but heard a lot.

    Reply

    Athul Jayaram

    Right Friends…..

    Hide

    Perfect!! My site is working!!!!!!

    :D

    Reply

    Leave a Comment

    Previous post:

    Next post:

    `