Skip to content

Commit 2579e53

Browse files
committed
Make use of the priority obtained for wp_print_footer_scripts
1 parent b5bf0e9 commit 2579e53

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/wp-includes/script-loader.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,18 +3571,19 @@ static function () use ( $placeholder ) {
35713571
* swap out _wp_footer_scripts() with an alternative which captures the printed styles (for hoisting to HEAD) before
35723572
* proceeding with printing the footer scripts.
35733573
*/
3574-
$wp_footer_priority = has_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
3575-
if ( false === $wp_footer_priority || false === has_action( 'wp_footer', 'wp_print_footer_scripts' ) ) {
3574+
$wp_print_footer_scripts_priority = has_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
3575+
if ( false === $wp_print_footer_scripts_priority || false === has_action( 'wp_footer', 'wp_print_footer_scripts' ) ) {
35763576
// The normal priority for wp_print_footer_scripts() is to run at 20.
35773577
add_action( 'wp_footer', $capture_late_styles, 20 );
35783578
} else {
3579-
remove_action( 'wp_print_footer_scripts', '_wp_footer_scripts' );
3579+
remove_action( 'wp_print_footer_scripts', '_wp_footer_scripts', $wp_print_footer_scripts_priority );
35803580
add_action(
35813581
'wp_print_footer_scripts',
35823582
static function () use ( $capture_late_styles ) {
35833583
$capture_late_styles();
35843584
print_footer_scripts();
3585-
}
3585+
},
3586+
$wp_print_footer_scripts_priority
35863587
);
35873588
}
35883589

0 commit comments

Comments
 (0)