[wp-trac] [WordPress Trac] #63965: HTML Validation Error: wp_print_speculation_rules uses type="speculationrules"

WordPress Trac noreply at wordpress.org
Fri Sep 12 14:37:03 UTC 2025


#63965: HTML Validation Error: wp_print_speculation_rules uses
type="speculationrules"
-----------------------------+------------------------
 Reporter:  svilupporobyone  |       Owner:  (none)
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  General          |     Version:
 Severity:  normal           |  Resolution:  duplicate
 Keywords:                   |     Focuses:
-----------------------------+------------------------
Changes (by sabernhardt):

 * status:  new => closed
 * focuses:  accessibility, javascript, coding-standards =>
 * version:  6.8.2 =>
 * milestone:  Awaiting Review =>
 * keywords:  needs-patch =>
 * resolution:   => duplicate


Old description:

> In WordPress, the function wp_print_speculation_rules() generates inline
> scripts like this:
> <script type="speculationrules"> ... </script>
> While this works correctly in browsers, it fails HTML validation (e.g.,
> W3C Validator) because type="speculationrules" is not a valid MIME type.
> The validator reports:
> Bad value speculationrules for attribute type on element script: Subtype
> missing.

New description:

 In WordPress, the function `wp_print_speculation_rules()` generates inline
 scripts like this:
 `<script type="speculationrules"> ... </script>`
 While this works correctly in browsers, it fails HTML validation (e.g.,
 W3C Validator) because `type="speculationrules"` is not a valid MIME type.
 The validator reports:
 Bad value speculationrules for attribute type on element script: Subtype
 missing.

--

Comment:

 Hi and welcome to WordPress Core Trac!

 This was already reported on #63289 and #63801.

 The `speculationrules` value is valid, but the W3C Validator still needs
 to recognize the speculation rules API.
 https://github.com/validator/validator/issues/1814

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63965#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list