• Resolved agm285

    (@agm285)


    I’ve been searching for info but the only relevant doc I found was 6 years old. (https://www.ads-software.com/ideas/topic/use-html-doctype-not-xhtml)

    I agree completely with the author’s sentiment: we should be creating valid html, not xhtml that “validates” as html. xhtml seems to be a dead-end, browser-wise. It’s html5 now.

    There’s a WP (apparently official) document that says, “it’s xhtml — deal with it” (https://codex.www.ads-software.com/HTML_to_XHTML). (Which is, I have to say, ridiculous, since WP’s meta tag says the content is text/html!) Yet even this document says there are problems with xhtml, and even offers a link to a plugin to fix WP output. Unfortunately, the link is no longer valid.

    Is there a “correct” way to force WP to output html?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Jon (Kenshino)

    (@kenshino)

    Lord Jon

    Which markup are xhtml?

    Most of the output are actually theme specific.

    That document you refer to is actually really pretty old.

    Is your Theme HTML5 compliant?

    Thread Starter agm285

    (@agm285)

    That’s true. I suppose the meta tag in the head is theme-specific. In my case, I’m using _S (underscores.me) as a starting point for a new theme. But it’s interesting that wherever I check the meta-tag ‘content’ value, it says text/html. If WP is outputting xhtml, the content meta tag should NOT be saying html. (<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />)

    When entering Page content, even if I’m in the text tab (not visual), the system will insert a line-break wherever I hit enter. When it does, it uses the pseudo-xml syntax of <br /> All WP-generated code uses this syntax for un-closed tags, like img, input, etc.

    I would like my output to be proper html–not xhtml. Just wondering if there’s a “right way” to do that. Thanks.

    Jon (Kenshino)

    (@kenshino)

    Lord Jon

    Dear agm285,

    After reading your post, it did daunt on me that TinyMCE is still outputting xhtml. That is somewhat interesting, I did a search on Trac but didn’t find anything directly relevant.

    Perhaps that is a move towards html fully, but I guess it takes many stages for full implementation.

    You are definitely right though that line breaks are changing to
    and that is due to wpautop (not TinyMCE). There are some work being done, I found one that is pretty promising at https://core.trac.www.ads-software.com/ticket/30644

    As for image tags and likely others, those are done by TinyMCE. As far as I know, you can change that by looking at

    tiny_mce_before_init (WordPress Hook) to alter TinyMCE’s settings for it is initialised

    And TinyMCE apparently allows html output (xhtml is apparently default). https://www.tinymce.com/wiki.php/Configuration3x:element_format

    As I understand, HTML5 has just at the end of 2014 been finalised. Perhaps this change will take some time ??

    Thread Starter agm285

    (@agm285)

    Many thanks. Maybe one day html/xhtml output will just be a toggle in the Dashboard.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP creates xhtml markup but defines content as html’ is closed to new replies.