[wp-trac] [WordPress Trac] #27407: wp_enqueue_scripts: jQuery loads in head despite of being included as dependency of another footer script

WordPress Trac noreply at wordpress.org
Thu Mar 27 04:48:04 UTC 2014


#27407: wp_enqueue_scripts: jQuery loads in head despite of being included as
dependency of another footer script
---------------------------+-------------------------
 Reporter:  Marventus      |       Owner:
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:
Component:  Script Loader  |     Version:  trunk
 Severity:  normal         |  Resolution:  worksforme
 Keywords:                 |     Focuses:
---------------------------+-------------------------
Changes (by jeremyfelt):

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


Comment:

 With the following code, I am able to load jQuery in the footer using both
 Twenty Twelve and Twenty Fourteen.

 {{{
 function enqueue_my_scripts() {
         wp_deregister_script( 'jquery' );
         wp_register_script( 'jquery', '/wp-includes/js/jquery/jquery.js',
 array(), '1.11.0', true );
         wp_enqueue_script( 'my-script', '/wp-content/plugins/my-script-
 plugin/script.js', array( 'jquery' ), false, true );
 }
 add_action( 'wp_enqueue_scripts', 'enqueue_my_scripts' );
 }}}

 Core's registration of jQuery must explicitly be unregistered. The new
 registration of jQuery must explicitly tell it to load in the footer.

 I'm going to close this ticket out. Please feel free to reopen if a
 different result is found or expected.

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


More information about the wp-trac mailing list