[wp-trac] Re: [WordPress Trac] #9346: wp_enqueue_script() doesn't work mid-page for footer scripts

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 16 12:58:12 GMT 2009


#9346: wp_enqueue_script() doesn't work mid-page for footer scripts
--------------------------+-------------------------------------------------
 Reporter:  Viper007Bond  |       Owner:  azaozz        
     Type:  defect (bug)  |      Status:  new           
 Priority:  normal        |   Milestone:  Future Release
Component:  JavaScript    |     Version:  2.8           
 Severity:  normal        |    Keywords:  needs-patch   
--------------------------+-------------------------------------------------

Comment(by Viper007Bond):

 Debugged and found the problem.

 When `WP_Scripts::do_item()` fires for outputting the header scripts and
 comes across a script that is meant for the footer, it tosses that that
 handle into the `WP_Scripts::in_footer` array and aborts outputting it.

 Calling `wp_enqueue_script()` after that point doesn't add the script to
 the `WP_Scripts::in_footer` array, so it never gets properly registered.

 I have a couple solutions in mind, but I'll let someone more at home with
 the class (azaozz perhaps?) come up with the solution to ensure it's the
 cleanest one.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9346#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list