From c0cc6617f20e3cc58347f45462aced7a0dfeeda3 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 11 Aug 2018 17:42:49 +0000 Subject: [PATCH] Script/Style Dependencies: Make sure that inline scripts for handles without a source are printed. See [36550] for `WP_Styles`. Props bpayton. Fixes #44551. Built from https://develop.svn.wordpress.org/trunk@43565 git-svn-id: http://core.svn.wordpress.org/trunk@43394 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class.wp-scripts.php | 16 +++++++++++++++- wp-includes/version.php | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index cf26b05f16..781de8c109 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -271,6 +271,12 @@ class WP_Scripts extends WP_Dependencies { $after_handle = sprintf( "\n", $after_handle ); } + if ( $before_handle || $after_handle ) { + $inline_script_tag = "{$cond_before}{$before_handle}{$after_handle}{$cond_after}"; + } else { + $inline_script_tag = ''; + } + if ( $this->do_concat ) { /** * Filters the script loader source. @@ -312,7 +318,15 @@ class WP_Scripts extends WP_Dependencies { } // A single item may alias a set of items, by having dependencies, but no source. - if ( ! $obj->src ) { + if ( ! $src ) { + if ( $inline_script_tag ) { + if ( $this->do_concat ) { + $this->print_html .= $inline_script_tag; + } else { + echo $inline_script_tag; + } + } + return true; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 26ffe755dc..9542fa6925 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-43564'; +$wp_version = '5.0-alpha-43565'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.