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

WordPress Trac noreply at wordpress.org
Sun Mar 12 16:37:25 UTC 2017


#40134: Invalid data for scripts in footer
------------------------------+-----------------------------
 Reporter:  sebastian.pisula  |      Owner:
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Script Loader     |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 During register scripts via wp_register_script in last param I can choose
 that script should be in footer. In function we see:

 {{{#!php
 <?php
 if ( $in_footer ) {
      $wp_scripts->add_data( $handle, 'group', 1 );
 }
 }}}

 so footer scripts I should check use this code:

 {{{#!php
 <?php
 $wp_scripts = wp_scripts();

 if ( $wp_scripts->get_data( $handle, 'group' ) ) {
         echo 'in footer';
 } else {
         echo 'in header';
 }
 }}}

 I check for this: admin-bar and I have false -> `in header`. We can see
 this code:

 {{{#!php
 <?php
 $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js",
 array(), false, 1 );
 }}}

 This should be in footer (and is, but I can't check it via my script).

 I think that this is bug.

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


More information about the wp-trac mailing list