[wp-trac] [WordPress Trac] #22249: Add ability to set or remove attributes on enqueued scripts and styles.

WordPress Trac noreply at wordpress.org
Tue Jun 10 16:37:17 UTC 2025


#22249: Add ability to set or remove attributes on enqueued scripts and styles.
-------------------------------------+----------------------
 Reporter:  ryanve                   |       Owner:  (none)
     Type:  enhancement              |      Status:  closed
 Priority:  normal                   |   Milestone:
Component:  Script Loader            |     Version:
 Severity:  normal                   |  Resolution:  invalid
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+----------------------
Changes (by westonruter):

 * status:  assigned => closed
 * resolution:   => invalid
 * milestone:  Future Release =>


Comment:

 For scripts with `type="module"`, there is now a
 [https://make.wordpress.org/core/2024/03/04/script-modules-in-6-5/ Script
 Modules API] in core, using a distinct API from registering and enqueueing
 classic scripts.

 Adding `defer` and `async` attributes landed with #12009.

 Adding `fetchpriority` is being worked on in #61734.

 Otherwise, attributes on classic script tags can be modified with the
 `wp_script_attributes` filter (and `wp_inline_script_attributes` for
 inline scripts). (See
 [https://gist.github.com/westonruter/c8b49406391a8d86a5864fb41a523ae9
 example] for how this can be used to apply Strict CSP.)

 Therefore, I'm closing this as invalid because I believe everything that
 has been requested is now possible

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


More information about the wp-trac mailing list