mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-11 22:29:48 +01:00
Avoid a PHP notice in wp_enqueue_script()
if $handle is an array.
Calling `wp_enqueue_script()` with an array as the first argument is a "hidden feature" and should be avoided. Use dependencies instead. props sorich87 for initial patch. fixes #31636. see #14488. Built from https://develop.svn.wordpress.org/trunk@31887 git-svn-id: http://core.svn.wordpress.org/trunk@31866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
29907e5f8b
commit
4fbba16960
@ -209,7 +209,7 @@ function wp_deregister_script( $handle ) {
|
|||||||
* @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
|
* @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
|
||||||
*
|
*
|
||||||
* @since 2.6.0
|
* @since 2.6.0
|
||||||
|
*
|
||||||
* @param string $handle Name of the script.
|
* @param string $handle Name of the script.
|
||||||
* @param string|bool $src Path to the script from the root directory of WordPress. Example: '/js/myscript.js'.
|
* @param string|bool $src Path to the script from the root directory of WordPress. Example: '/js/myscript.js'.
|
||||||
* @param array $deps An array of registered handles this script depends on. Default empty array.
|
* @param array $deps An array of registered handles this script depends on. Default empty array.
|
||||||
@ -224,14 +224,17 @@ function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false
|
|||||||
|
|
||||||
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
|
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
|
||||||
|
|
||||||
$_handle = explode( '?', $handle );
|
|
||||||
|
|
||||||
if ( $src ) {
|
if ( $src || $in_footer ) {
|
||||||
$wp_scripts->add( $_handle[0], $src, $deps, $ver );
|
$_handle = explode( '?', $handle );
|
||||||
}
|
|
||||||
|
|
||||||
if ( $in_footer ) {
|
if ( $src ) {
|
||||||
$wp_scripts->add_data( $_handle[0], 'group', 1 );
|
$wp_scripts->add( $_handle[0], $src, $deps, $ver );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $in_footer ) {
|
||||||
|
$wp_scripts->add_data( $_handle[0], 'group', 1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$wp_scripts->enqueue( $handle );
|
$wp_scripts->enqueue( $handle );
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.2-beta2-31886';
|
$wp_version = '4.2-beta2-31887';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user