Support » Fixing WordPress » DOCTYPE in header.php is removed / stripped

  • Resolved oxfordian3

    (@oxfordian3)


    The DOCTYPE declaration is being stripped out of all page displays.

    It is very bizarre. We use an HTML5 template, and the DOCTYPE declaration is in the theme’s header.php:

    <!DOCTYPE html>
    <html lang="en" xmlns:fb="http://ogp.me/ns/fb#">
    <meta charset="utf-8">
    etc. etc.

    This has been working for several years, but some time in the past few weeks the HTML sent to the browser omits the DOCTYPE. As a result, our IE displays look very broken.

    I took an HTML source of a sample page and uploaded it as a static HTML file with the <!DOCTYPE html> line inserted , and that works. That makes me believe that it is not a javascript issue (since all JS operations are included in the HTML snapshot).

    We have W3 Total Cache, which does do some alterations. I’ve done tests with the cache disabled, but maybe there’s something else related to that plugin?

    Anyone else encounter this issue?

Viewing 2 replies - 1 through 2 (of 2 total)
  • What’s your site?

    Thread Starter oxfordian3

    (@oxfordian3)

    I found the source of the problem.

    It was indeed related to the W3 Total Cache plugin, and specifically to the Minify HTML feature, which was set to “HTML Tidy”. I think this enables the use of the PHP Tidy module.

    Once I changed the Minify HTML method from “HTML Tidy” to “Default”, the <!DOCTYPE html> was restored.

    Maybe there are other workarounds (or issues that are specific only to our site), but for now this restores our layout (which looked very broken on Internet Explorer without the HTML5 declaration).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘DOCTYPE in header.php is removed / stripped’ is closed to new replies.