• maxcady

    (@maxcady)


    I was wondering if I need the </head> tag in any template on wordpress.

    I notice that when I take it out, my site still looks the same AND I don’t get the malware injected in the header if I remove the tag.

    I’ve removed it on a few sites and everything looks and works great still.

    Am I messing something up if I remove the </head> tag in the header.php file?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • In HTML5 it’s not strictly necessary to close certain HTML tags, but I still don’t find any good reason not to do it. Closing the tags makes the code more readable and easy to follow.

    “A head element’s end tag may be omitted if the head element is not immediately followed by a space character or a comment.”

    https://www.w3.org/TR/2011/WD-html5-20110525/syntax.html#optional-tags

    Thread Starter maxcady

    (@maxcady)

    Thanks for your response, Boris. If I don’t close them, will search engine have trouble reading things that go in the header such as meta descriptions and keywords for each post and page?

    I’m not sure, but I don’t think that they will have some issues reading the meta information. Even Google didn’t closed its </body></html> tags few years back just to save on bandwidth and space (they were saving around 39GB of data per day).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Do I need the head tag in the header php file?’ is closed to new replies.