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

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


#9346: wp_enqueue_script() doesn't work mid-page
--------------------------+-------------------------------------------------
 Reporter:  Viper007Bond  |       Owner:  azaozz        
     Type:  defect (bug)  |      Status:  new           
 Priority:  normal        |   Milestone:  Future Release
Component:  JavaScript    |     Version:  2.8           
 Severity:  normal        |    Keywords:  needs-patch   
--------------------------+-------------------------------------------------
 Create a footer script at `init`, `plugins_loaded`, or whatever. Doesn't
 matter, just early.

 {{{
 wp_register_script( 'myscript' '/some/path/script.js', array(), '1.2.3',
 true );
 }}}

 Now if we were to do `wp_enqueue_script( 'myscript' );` directly after
 that, the script would be outputted in the footer as expected.

 However if we were to do the enqueue farther down the page, say inside a
 `the_content` filter, it doesn't work. It should. I need to be able to
 dynamically enqueue scripts for example based on shortcodes.

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


More information about the wp-trac mailing list