Skip to content

HTML API: Normalize TITLE content generation.#11581

Draft
dmsnell wants to merge 2 commits intoWordPress:trunkfrom
dmsnell:html-api/improve-title-generation
Draft

HTML API: Normalize TITLE content generation.#11581
dmsnell wants to merge 2 commits intoWordPress:trunkfrom
dmsnell:html-api/improve-title-generation

Conversation

@dmsnell
Copy link
Copy Markdown
Member

@dmsnell dmsnell commented Apr 15, 2026

The HTML TITLE element behaves differently than other elements because it contains no content other than parsed character data; in other words, everything until the closing TITLE tag is treated as plaintext, while character references are decoded.

WordPress post titles, however, are nominally rich text and may contain markup which will be rendered when displayed inside a theme; just not when found insdie the TITLE element itself.

This patch introduces a new semantically-named function to transform rich HTML for rendering into the TITLE element and replaces existing uses of esc_html() and _e() to parse the input HTML, remove anything that isn’t text, and then normalize the escaping of syntax characters.

dmsnell added 2 commits April 15, 2026 13:33
The HTML TITLE element behaves differently than other elements because
it contains no content other than parsed character data; in other words,
everything until the closing TITLE tag is treated as plaintext, while
character references are decoded.

WordPress post titles, however, are nominally rich text and may contain
markup which will be rendered when displayed inside a theme; just not
when found insdie the TITLE element itself.

This patch introduces a new semantically-named function to transform
rich HTML for rendering into the TITLE element and replaces existing
uses of `esc_html()` and `_e()` to parse the input HTML, remove anything
that isn’t text, and then normalize the escaping of syntax characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant