From e82da3b7301d0e29ff2b166ed08b92e32009e0a5 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 8 Feb 2012 15:29:24 +0000 Subject: [PATCH] Wait until init to fire wp_default_scripts. Fixes localization issues when a plugin calls wp_enqueue_script() too early (in spite of the _doing_it_wrong warning signs added in #11526). fixes #19959. git-svn-id: http://svn.automattic.com/wordpress/trunk@19865 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class.wp-scripts.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index f12f0cac1..ceaaad565 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -31,6 +31,13 @@ class WP_Scripts extends WP_Dependencies { var $default_dirs; function __construct() { + if ( did_action( 'init' ) ) + $this->init(); + else + add_action( 'init', array( $this, 'init' ), 0 ); + } + + function init() { do_action_ref_array( 'wp_default_scripts', array(&$this) ); }