From 9bcf0363c02d104e7983dab2e0745d8d934c4872 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 22 Mar 2019 14:12:15 -0400 Subject: [PATCH] Plugin: Account for null return of `get_current_screen` (#14558) --- gutenberg.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gutenberg.php b/gutenberg.php index 483f41ffc709d..549d2251b17a3 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -93,7 +93,8 @@ function is_gutenberg_page() { _deprecated_function( __FUNCTION__, '5.3.0', 'WP_Screen::is_block_editor' ); require_once ABSPATH . 'wp-admin/includes/screen.php'; - return get_current_screen()->is_block_editor(); + $screen = get_current_screen(); + return ! is_null( $screen ) && get_current_screen()->is_block_editor(); } /** @@ -159,5 +160,6 @@ function gutenberg_init() { _deprecated_function( __FUNCTION__, '5.3.0' ); require_once ABSPATH . 'wp-admin/includes/screen.php'; - return get_current_screen()->is_block_editor(); + $screen = get_current_screen(); + return ! is_null( $screen ) && get_current_screen()->is_block_editor(); }