[wp-trac] [WordPress Trac] #11944: Allow wp_enqueue_script() after wp_head()

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 19 01:14:58 UTC 2010


#11944: Allow wp_enqueue_script() after wp_head()
--------------------------+-------------------------------------------------
 Reporter:  scribu        |       Owner:                
     Type:  defect (bug)  |      Status:  new           
 Priority:  normal        |   Milestone:  Future Release
Component:  General       |     Version:                
 Severity:  normal        |    Keywords:  needs-patch   
--------------------------+-------------------------------------------------
 Say you have this code:

 {{{
 function my_template_tag() {
   // output some stuff here

   wp_enqueue_script('handle', ..., $in_footer = true);
 }
 }}}

 It should just work, even if it's called after wp_head().

 Currently, you have to do something like this:

 {{{
 function my_template_tag() {
   // output some stuff here

   add_action('wp_footer', 'my_template_tag_script');
 }

 function my_template_tag_script() {
   wp_register_script('handle', ...);
   wp_print_scripts('handle');
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11944>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list