When calling wp_enqueue_script() with a registered $handle, no $src (using the default value, false), and true as the value for $in_footer, ensure that the script actually loads in the footer. If the handle was registered with $in_footer equal to true, this already worked. Make it work for scripts like where $in_footer was initially false, example: wp_enqueue_script( 'json2', false, array(), false, true );

Props SergeyBiryukov.
Fixes #14488.


git-svn-id: https://develop.svn.wordpress.org/trunk@31028 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-01-03 02:40:11 +00:00
parent 8d990ce6f8
commit 8476a2e2fa

View File

@ -203,12 +203,16 @@ function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false
$wp_scripts = new WP_Scripts();
}
$_handle = explode( '?', $handle );
if ( $src ) {
$_handle = explode('?', $handle);
$wp_scripts->add( $_handle[0], $src, $deps, $ver );
if ( $in_footer )
$wp_scripts->add_data( $_handle[0], 'group', 1 );
}
if ( $in_footer ) {
$wp_scripts->add_data( $_handle[0], 'group', 1 );
}
$wp_scripts->enqueue( $handle );
}