In wp_localize_script()
, instantiate the $wp_scripts
global instead of bailing when it is called before wp_enqueue_scripts
. This allows wp_enqueue_media()
to be called on the front end with no JS errors.
Props ericlewis. Fixes #24724. git-svn-id: https://develop.svn.wordpress.org/trunk@28840 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0105f41c77
commit
f106f80768
@ -116,8 +116,7 @@ function wp_localize_script( $handle, $object_name, $l10n ) {
|
||||
if ( ! did_action( 'init' ) )
|
||||
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
|
||||
'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
|
||||
|
||||
return false;
|
||||
$wp_scripts = new WP_Scripts();
|
||||
}
|
||||
|
||||
return $wp_scripts->localize( $handle, $object_name, $l10n );
|
||||
|
Loading…
Reference in New Issue
Block a user