mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@28840 git-svn-id: http://core.svn.wordpress.org/trunk@28644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6ab2f15b0b
commit
6bcb24a344
@ -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