diff --git a/gutenberg.php b/gutenberg.php index 483f41ffc709de..549d2251b17a3f 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(); }