Support » Fixing WordPress » Header appearing in body tag

  • Resolved ElSebas


    Im having a problem with my code, all the info that should be in the header tag in the body tag here is my code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Any ideas why this is happening??

Viewing 15 replies - 1 through 15 (of 16 total)
  • design_dolphin


    Can you please post the code in a pastebin?



    Sorry didn’t know that here is the url:



    Also don’t know why but after the body tag and before the content I see some space in firebug and in Chrome show me some quotes like:

      meta tags and stylesheets
      the content



    Can you try removing this part:

    <!--[if lt IE 9]>
                    <script src=""></script>
                    <script src=""></script>
                    <title><?php wp_title('',true,'right'); ?><?php bloginfo('name'); ?></title>
                    <?php if( is_singular() ) wp_enqueue_script( 'comment_reply' ); ?>

    And see if that makes a difference?

    Might be an error in the included code somewhere. If it does make a difference add each line back one by one to see when it happens. Is ‘html’ a legal doctype? Otherwise try this for example, see if that helps:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "">

    That is all that I can see that can be causing the problem, but I could be overlooking something.



    No didn’t make a difference. Here is are some screenshots of the code


    How did you fixed? i have the same problem.

    @cvatca, you’d be best starting your own topic…. old topics with multiple posts don’t get further attention

    Hi ElSebas, i’m having the same issue. Can you give me your solution to check if it is work in my case?

    Please mark thread as resolved so that

    – others with similar problem can see it as resolved and will read this thread for help if they have similar problem

    – people providing help see it as resolved and will not waste time reading this post.

    ElSebas, how on earth did you fix the problem?

    Same with me. what was the solution?

    – As well, I deleted all script includes,, temporarily disabled wp_head(),
    temporarily disabled all plugins, but to no effect.

    Hi ElSebas, would be fine if you can share the solutions with us so another people can fix the issue too.
    I fixed but not sure if the solution is the yours, i made a new clean theme and add the all things from the basic theme.
    For me adding bodyclass function to the body tag fix the issue, very strange but this works for me.




    I had this same strange problem and what’s worse is that in firebug and chrome inspector they both show the <head> content within the <body> tags….but when viewing the source the <head> content is in the correct place.

    Basically after rebuilding my theme bit by bit I found my functions.php and two of the files it was including were UTF8 encoded and by changing their encoding to UTF8-without-bom sorted this issue..

    I think that is the solution ElSebas found.
    Baffled me for half a day trying to work that out….

    I wonder if this is an UTF8 issue with some browser inspectors?

    In the end just another test to add to the build scripts to be sure that all files are in the correct format 🙂



    Hi All,

    Confirmation of Peter’s solution: I had changed my header.php file to UTF-8 (for Chinese text) and that caused this issue.

    I changed it to sans BOM and all back to normal.

    Wondering though, does this just affect browser inspection tools (noticied on Chrome and Firebug) and why?


Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Header appearing in body tag’ is closed to new replies.