[wp-trac] [WordPress Trac] #63887: Add sourceURL to inline scripts and styles
WordPress Trac
noreply at wordpress.org
Tue Oct 7 23:32:21 UTC 2025
#63887: Add sourceURL to inline scripts and styles
--------------------------------------+------------------------------
Reporter: jonsurrell | Owner: jonsurrell
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.9
Component: Script Loader | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: javascript, css
--------------------------------------+------------------------------
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/63887#comment:53>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list