From 8476a2e2fad14ee6bd5753310f6c6bfbcc74e815 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 3 Jan 2015 02:40:11 +0000 Subject: [PATCH] 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 --- src/wp-includes/functions.wp-scripts.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/functions.wp-scripts.php b/src/wp-includes/functions.wp-scripts.php index 6eb7a44f89..0e09a2dd66 100644 --- a/src/wp-includes/functions.wp-scripts.php +++ b/src/wp-includes/functions.wp-scripts.php @@ -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 ); }