[wp-trac] [WordPress Trac] #25247: WP_Dependencies unsets a to do item when it isn't loaded

WordPress Trac noreply at wordpress.org
Fri Feb 26 12:14:35 UTC 2016


#25247: WP_Dependencies unsets a to do item when it isn't loaded
--------------------------------------+------------------------
 Reporter:  markoheijnen              |       Owner:  chriscct7
     Type:  defect (bug)              |      Status:  reopened
 Priority:  normal                    |   Milestone:  4.5
Component:  Script Loader             |     Version:  3.6
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------
Changes (by pcfreak30):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 I have recently encountered this myself. If you force a item to the
 footer, but it has dependencies, the dependencies may not go to the footer
 at all due to being removed from the to_do array. An example is forcing
 the "jquery" script alias to the footer.

 {{{#!php
 <?php
 add_action('wp_print_scripts', function () {
     if (!is_admin()) {
         $jquery = wp_scripts()->registered['jquery'];
         wp_dequeue_script('jquery');
         wp_deregister_script('jquery');
         wp_register_script('jquery', $jquery->src, $jquery->deps,
 $jquery->ver, true);
     }
 }, 0);
 }}}

 A very simple 2-3 line patch is attached

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


More information about the wp-trac mailing list