wp_head loads into body tag in WordPress

I have a WordPress site and this morning I have noticed that wp_head() outputs content into body tag.

Here is the code of header.php

Read More
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
    <head>
        <meta charset="<?php bloginfo( 'charset' ); ?>">
        <meta name="viewport" content="width=device-width">
        <title><?php wp_title( '|', true, 'right' ); ?></title>
        <link rel="profile" href="http://gmpg.org/xfn/11">
        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
        <script>(function() {
            var _fbq = window._fbq || (window._fbq = []);
            if (!_fbq.loaded) {
            var fbds = document.createElement('script');
            fbds.async = true;
            fbds.src = '//connect.facebook.net/en_US/fbds.js';
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(fbds, s);
            _fbq.loaded = true;
           }
           _fbq.push(['addPixelId', 'xxx']);
          })();
          window._fbq = window._fbq || [];
          window._fbq.push(['track', 'PixelInitialized', {}]);
        </script>
        <noscript><img height="1" width="1" alt="" style="display:none"                    src="https://www.facebook.com/tr?id=xxx&amp;ev=NoScript" /></noscript>

        <script type="text/javascript">
           /* <![CDATA[ */
           var google_conversion_id = xxxx;
           var google_custom_params = window.google_tag_params;
           var google_remarketing_only = true;
           /* ]]> */
        </script>
        <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
        </script>
        <noscript>
            <div style="display:inline;">
            <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/xxxx/?value=0&amp;guid=ON&amp;script=0"/>
            </div>
        </noscript>

       <?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
    <div id="page" class="hfeed site">
<?php do_action( 'before' ); ?>
<header id="masthead" class="site-header" role="banner">
    <div class="container">
        <div class="row">
            <div class="site-branding col-sm-4">
                <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo home_url(); ?>/wp-content/uploads/2014/06/Logo-nov-.png" alt="<?php bloginfo( 'name' ); ?>"/></a></h1>

            </div>

        <div class="col-sm-8 mainmenu">
        <div class="mobilenavi"></div>
                <?php wp_nav_menu( array( 'container_id' => 'submenu', 'theme_location' => 'primary','container_class' => 'topmenu','menu_id'=>'topmenu' ,'menu_class'=>'sfmenu' ) ); ?>
        </div>

        </div> <!-- end row -->
    </div>
</header><!-- #masthead -->


<?php if( is_page_template('homepage.php') ){ get_template_part( 'inc/feature' ); } ?>

<div id="content" class="site-content ">

I have tried removing remarketing tags, but makes no difference. Also I have tried disabling all plugins, and still no go

Related posts

Leave a Reply

1 comment

  1. Ok, so according to Matt Gibson comment, I have found the solution. Not the perfect one, but it is a solution that works.

    I have moved wp_head() up, right after <link rel="pingback">... ant it works now.