[wp-trac] [WordPress Trac] #58873: Add function to pass variables to scripts

WordPress Trac noreply at wordpress.org
Tue Sep 23 15:32:08 UTC 2025


#58873: Add function to pass variables to scripts
-----------------------------+--------------------------------------
 Reporter:  apedog           |       Owner:  (none)
     Type:  feature request  |      Status:  reopened
 Priority:  normal           |   Milestone:  Future Release
Component:  Script Loader    |     Version:  5.7
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:  javascript, performance
-----------------------------+--------------------------------------

Comment (by jonsurrell):

 This is ready for deveopment. The Script Modules implementation is here
 and can serve as inspiration:

 https://core.trac.wordpress.org/browser/tags/6.8.2/src/wp-includes/class-
 wp-script-modules.php#L443

 The implementation should be similar to the Script Modules implementation.
 I'd say the script tag containing the data should be printed before
 `extra` scripts (those added by `wp_localize_script()`.

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


More information about the wp-trac mailing list