From 0dc073e5892897332470238905d7c7b3840ac7d9 Mon Sep 17 00:00:00 2001 From: noisysocks Date: Thu, 8 Oct 2020 01:21:07 +0000 Subject: [PATCH] Editor: Only call should_load_block_editor_scripts_and_styles on admin screens Do not call the should_load_block_editor_scripts_and_styles filter on non-admin screens. This makes it less likely that one will accidentally call get_current_screen() when it doesn't exist. Follow-up to [49080]. Props noahtallen. See #51330. Built from https://develop.svn.wordpress.org/trunk@49102 git-svn-id: http://core.svn.wordpress.org/trunk@48864 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/script-loader.php | 8 ++++++-- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index e595bf0d28..87e48e6845 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -2185,7 +2185,7 @@ function script_concat_settings() { * @global WP_Screen $current_screen WordPress current screen object. */ function wp_common_block_scripts_and_styles() { - if ( is_admin() && ! wp_should_load_block_editor_scripts_and_styles() ) { + if ( ! wp_should_load_block_editor_scripts_and_styles() ) { return; } @@ -2219,11 +2219,15 @@ function wp_common_block_scripts_and_styles() { function wp_should_load_block_editor_scripts_and_styles() { global $current_screen; + if ( ! is_admin() ) { + return false; + } + $is_block_editor_screen = ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor(); /** * Filters the flag that decides whether or not block editor scripts and - * styles are going to be enqueued on the current screen. + * styles are going to be enqueued on the current admin screen. * * @since 5.6.0 * diff --git a/wp-includes/version.php b/wp-includes/version.php index 9f317caf63..05153bb54c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-49101'; +$wp_version = '5.6-alpha-49102'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.