[wp-trac] [WordPress Trac] #31636: 4.2-beta1 - PHP warning when enqueuing script on specific pages only

WordPress Trac noreply at wordpress.org
Fri Mar 13 19:16:23 UTC 2015


#31636: 4.2-beta1 - PHP warning when enqueuing script on specific pages only
---------------------------+------------------------------
 Reporter:  harmr          |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Script Loader  |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by ocean90):

 It's `wp_enqueue_script( array ( 'jquery', 'jquery-ui-tabs','jquery-ui-
 datepicker','jquery-ui-slider' ) );` which is a "hidden feature" because
 `WP_Dependencies->enqueue()` supports an array. You should use script
 dependencies for this.

 In 4.1:
 {{{
 // … init stuff …
 if ( $src ) {
         $_handle = explode('?', $handle);
         $wp_scripts->add( $_handle[0], $src, $deps, $ver );
         if ( $in_footer )
                 $wp_scripts->add_data( $_handle[0], 'group', 1 );
 }
 $wp_scripts->enqueue( $handle );
 }}}

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


More information about the wp-trac mailing list