[wp-trac] [WordPress Trac] #43403: Improve wp_add_inline_script()

WordPress Trac noreply at wordpress.org
Tue Aug 12 16:31:47 UTC 2025


#43403: Improve wp_add_inline_script()
---------------------------+----------------------
 Reporter:  alpipego       |       Owner:  (none)
     Type:  enhancement    |      Status:  closed
 Priority:  normal         |   Milestone:
Component:  Script Loader  |     Version:
 Severity:  normal         |  Resolution:  wontfix
 Keywords:                 |     Focuses:
---------------------------+----------------------
Changes (by jonsurrell):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 Thanks, this is a reasonable idea, however there are some difficulties.

 Primarily, [https://sirre.al/2025/08/06/safe-json-in-script-tags-how-not-
 to-break-a-site/ it isn't easy to recognize where a script tag and ends.]
 The current implementation is insufficient in that regard. There's a
 related change where the `HTML_Tag_processor` should be used to find the
 script contents in the case that it appears a script tag was provided.

 I'd be reluctant to make the change as described in this ticket becaue it
 can be problematic to print script tags that aren't vetted for correct
 escaping. That leads to issues like #62797.

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


More information about the wp-trac mailing list