[wp-trac] [WordPress Trac] #40134: Invalid data for scripts in footer

WordPress Trac noreply at wordpress.org
Wed Aug 13 13:30:44 UTC 2025


#40134: Invalid data for scripts in footer
------------------------------+-------------------------
 Reporter:  sebastian.pisula  |       Owner:  (none)
     Type:  defect (bug)      |      Status:  closed
 Priority:  normal            |   Milestone:
Component:  Script Loader     |     Version:
 Severity:  normal            |  Resolution:  worksforme
 Keywords:                    |     Focuses:
------------------------------+-------------------------
Changes (by jonsurrell):

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


Comment:

 I don't understand the issue being described. It seems like the issue is
 about the basic functionality of `::add_data()` and `::get_data()`. I
 don't see any problems with their behavior.

 I adapted the example and tested:

 {{{#!php
 <?php
 wp_enqueue_script(
         '_',
         plugins_url( 'x.js', __FILE__ ),
         array(),
         '0.0.0',
         true
 );

 global $wp_scripts;
 $wp_scripts->add_data( '_', 'group', 1 );
 add_action(
         'wp_footer',
         function () {
                 global $wp_scripts;
                 echo '<plaintext>';
                 var_dump( $wp_scripts->get_data( '_', 'group' ) );
         }
 );
 }}}

 `int(1)` is printed as expected.

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


More information about the wp-trac mailing list