[wp-trac] [WordPress Trac] #64513: HTML_Processor gets wrong breadcrumbs for elements in <head>
WordPress Trac
noreply at wordpress.org
Thu Jan 15 22:49:58 UTC 2026
#64513: HTML_Processor gets wrong breadcrumbs for elements in <head>
--------------------------+-----------------------------
Reporter: vicobot | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTML API | Version: 6.9
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
If you visit elements that typically appear in the `<head>`, like META or
LINK, the HTML_Processor returns a breadcrumbs array with BODY instead of
HEAD, e.g.
Array
(
[0] => HTML
[1] => BODY
[2] => META
)
How to reproduce:
- call `$processor = \WP_HTML_Processor::create_fragment($html)` on a full
HTML page, e.g. by hooking into `wp_template_enhancement_output_buffer`
- get `$processor->next_tag('META')` or some other tag that lives in
`<head>`
- get `$processor->get_breadcrumbs()` and check the resulting array, e.g.
with `print_r()` or by doing an `array_diff()` with the expected result
`['HTML', 'HEAD', 'META']`
Wordpress: 6.9 (php8.2-apache docker)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64513>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list