diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 4915c2ba98..6a3cf7d5e5 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -2470,7 +2470,7 @@ function script_concat_settings() { function wp_common_block_scripts_and_styles() { global $current_screen; - if ( is_admin() && ! $current_screen->is_block_editor() ) { + if ( is_admin() && ( $current_screen instanceof WP_Screen ) && ! $current_screen->is_block_editor() ) { return; } @@ -2504,7 +2504,7 @@ function wp_common_block_scripts_and_styles() { function wp_enqueue_registered_block_scripts_and_styles() { global $current_screen; - $is_editor = ( is_admin() && $current_screen->is_block_editor() ); + $is_editor = ( ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor() ); $block_registry = WP_Block_Type_Registry::get_instance(); foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) {