[wp-trac] [WordPress Trac] #20971: Delaying wp_default_scripts() prevents enqueing

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 15 12:27:23 UTC 2012


#20971: Delaying wp_default_scripts() prevents enqueing
--------------------------+-------------------
 Reporter:  nacin         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  3.4.1
Component:  General       |    Version:  3.4
 Severity:  major         |   Keywords:
--------------------------+-------------------
 wp_enqueue_script() only works on a handle that is already registered.
 That means that the delaying tactic in [19865] can break JavaScript
 enqueueing of default scripts (mostly by plugins, potentially by themes),
 as they no longer work until init has fired.

 This is significantly mitigated by
 [http://wpdevel.wordpress.com/2011/12/12/use-wp_enqueue_scripts-not-
 wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/ our change
 in 3.3] that caused some trouble, as most people fixed their code then,
 and more developers are watching for _deprecated and _doing_it_wrong
 notices. But, it still affects some poorly coded themes.

 We can fix this by double-calling wp_default_scripts() — calling it
 immediately but then calling it again on init in case it fires too early.

 The double-calling isn't new for us -- we do this when registering default
 taxonomies and post types as well.

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


More information about the wp-trac mailing list