[wp-trac] [WordPress Trac] #59446: Use script helper functions in admin to enable Content-Security-Policy opt-in

WordPress Trac noreply at wordpress.org
Tue Oct 7 23:32:20 UTC 2025


#59446: Use script helper functions in admin to enable Content-Security-Policy opt-
in
----------------------------+-----------------------------
 Reporter:  westonruter     |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Future Release
Component:  Administration  |     Version:  5.7
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  javascript
----------------------------+-----------------------------

Comment (by westonruter):

 In [changeset:"60913" 60913]:
 {{{
 #!CommitTicketReference repository="" revision="60913"
 Bundled Themes: Use `wp_print_inline_script_tag()` when available and
 include `sourceURL` for JS.

 Instead of manually constructing the markup for `SCRIPT` tags, leverage
 `wp_print_inline_script_tag()` when available to do the construction while
 also ensuring filters may inject additional attributes on the `SCRIPT`
 tags, such as `nonce` for CSP. When the function is not available (prior
 to WP 5.7), fall back to the manual markup construction.

 This also adds the `sourceURL` comments to the inline scripts to
 facilitate debugging, per #63887.

 Developed in https://github.com/WordPress/wordpress-develop/pull/9416.

 Follow-up to [60909], [60899].

 Props debarghyabanerjee, westonruter, hbhalodia, peterwilsoncc,
 sabernhardt, poena.
 See #63887, #59446.
 Fixes #63806.
 }}}

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


More information about the wp-trac mailing list