-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal error: Uncaught Error: Call to a member function is_block_editor() on null #15209
Comments
Solution function gutenberg_block_editor_admin_print_styles() {
$current_screen = get_current_screen()
if ( ! is_null ( $current_screen ) && $current_screen->is_block_editor() ) {
/** This action is documented in wp-admin/admin-footer.php */
// phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
do_action( 'admin_print_styles-widgets.php' );
}
}
add_action( 'admin_print_styles', 'gutenberg_block_editor_admin_print_styles' ); |
There were similar issues previously as in #14547 (comment) where That being said, it seems with the recurring presence of these sorts of errors that we should always be considerate of accounting for the possible failure conditions. This should also apply to all other action handlers of the same file where similar logic occurs. |
Sometimes conflicts occur, I tried installing the Classic Editor, which helped. But it might just be in my case. |
@auerserg - This might be a workaround, but you can use
Right after this block -
|
Hi, same issue when opening the setup assistant of |
This is slated to be fixed by #15983. |
Fixed in #15983. |
Describe the bug
In our theme we use MerlinWp Wizard and get following error during the activation
To reproduce
Steps to reproduce the behavior:
Expected behavior
The reason for this is that the function get_current_screen() returns null. As specified in the documentation for this function
You need to add a check if the function get_current_screen() returns the WP_Screen class and then call the method is_block_editor()
Additional context
The text was updated successfully, but these errors were encountered: