I have a wierd problem. If I inspect my WP pages using chrome element inspector I see two body tags thus:
<body cz-shortcut-listen="true">
<body>
This bit is to do with colorzilla (cz-shortcut-listen="true") in firebug it disappears. you have just 2 body tags with no classes.
The issue is not about the cz-shortcut-listen="true" bit coming from colorzilla. It is about the extra tag.
This duplication is causing styling and JS problems. If I view source then just a single
<body>
is displayed with no classes.
No classes from body_class() are displayed in either view but I can echo them out into the source quite happily when they are not within this line in header.php
<body <?php body_class();?>>
simply adding
<?php body_class();?>
above or below the line that renders the body tag displays all the body classes quite happily so they are being set.
If I comment out the line that renders the body tag in header.php using php commenting this body tag is still rendered
<body cz-shortcut-listen="true">
This happens with all themes and also to users outside of my local network and in chrome AND firefox so it seems not to be a theme or local browser issue. (See also UPDATE 2 below)
Has anyone any idea what it might be, it is a major headache and I'm quite stumped as to what it could be or how to even go about working out what the problem is.
Staging site displaying the problem here: http://eco.clearintent.co.uk/
UPDATE: This is happening on every WP installation on the server so is not wp install or theme specific.
Running wordpress 4.2.4 Server is running Apache/2.2.29 PHP/5.3.29 Amazon Linux on an EC2 m3.medium instance.
UPDATE 2: Tried installing a vanilla wordpress on a new ec2 instance running apache 2.4 and php 5.6 just to see and it has the same issue! Doesn't affect non-wordpress websites. Happens across browsers and networks so not specific to my local setup.
UPDATE 3: Getting the site using wget from command line delivers the correct code WITH the body classes in the single body tag. - I wondered if (as suggested below) this indicated that javascript was to blame but when Iaccessed the site in chrome with javascript disabled the issue didn't resolve so that seems to mean javascript isn't the issue.
UPDATE 4 As per the answer below the issue does lies in the strange character present in the body tag however, deleting and replacing this line doesn't work. The only thing that seems to work is surrounding the first line in html comments and having an identical uncommented line below, thus:
<!--<body <?php body_class(); ?>>-->
<body <?php body_class(); ?>>-->
If I remove the top commented line then the error re-occurs on the newly typed body tag.
If I remove the body tag from the commented line but still have an empty comment thus:
<!-- -->
<body <?php body_class(); ?>>-->
Or I include the body_class function in the comment thus:
<!--<?php body_class(); ?>-->
<body <?php body_class(); ?>>-->
The behaviour reappears so the first body tag (even though commented) has to be present for the new one to render properly.
I have checked the Apache and php utf-8 encodings are in place. I checked in the browser that the page was seen as utf8 which it is. On the server
file -bi header.php
displays the file as ascii.
This gets wierder and wierder, I have a hack to get things working but not an understanding of what is happening.
Any thoughts on how to debug this would be very very gratefully received.
Thanks,
Paul
SOLUTION: see below. I added a separate answer for clarity.
cz-shortcut-listen="true"
is being added to the existing body tag only.