I am finding a lot of validation errors courtesy of http://validator.w3.org/ in a clients website with the following HTML tag:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

It appears this was also used in the original version of the theme as well. I'm just wondering if I should go for a certain Doctype always over another?

  • how is it related to wordpress? This should be asked in an html oriented forum. Dec 23 '13 at 17:38
  • I thought this initially too ,however my logic went along the lines of since I am working with different plugins that often add HTML code that I don't have easy control of - I thought there might be a good way to set a doctype that will work with HTML from different sources, etc. Dec 23 '13 at 17:49
  • doctype is just a hint to the browser how to parse your html. just because you declare your html to be valid in a specific standard doesn't mean it is. This is even a bigger problem with UGC as users always find a way do break HTML in their content. Dec 23 '13 at 19:20

I think that is currently always a good idea to use the html5 doctype <!DOCTYPE html>. The best answer for use this type can you find in this SE Answer. The question and answer is not only in the context of WordPress, is always a part of serving on frontend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.