0

Apparently WordPress 5.x renders HTML5 in search forms, comment forms, comment lists, gallery, etc. I've deleted this support in functions.php and HTML5 is alive and kicking. It seems odd that I would need this today, or is this for legacy themes only? Thanks for clarifying

2

You still need to do it, if you want to use HTML5 markup for certain elements. WordPress doesn't have any other way to tell the difference between "legacy" themes and more recent ones, and the old markup is still the default for backwards compatibility reasons. As recently as 5.3 there are still changes being made that require declaring support for html5 (specifically, script and style tags)

I've just tested it myself, and removing the support declaration for comment-list changed the comments from using <article> tags to <div> tags, and removing support for comment-form meant that the newer type attribute values were no longer used, so the email field became type="text" instead of type="email".

The only reason not declaring support might not have an effect is if your theme is otherwise replacing the default markup in some way. For example, declaring HTML5 support for search-form won't do anything if your theme has its own searchform.php file.

I haven't confirmed this, but it's also likely that declaring support for gallery and caption only affect the Classic Editor, and that the markup for galleries and captions in the block editor will be HTML5 by default, since their markup is determined by the blocks.

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.