Make sure get_current_screen() is available (#33990)

* Make sure get_current_screen is available

* Add changelog
This commit is contained in:
Moon 2022-07-20 03:31:46 -07:00 committed by GitHub
parent 9bc4e88b1a
commit f56b1da519
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix a fatal when a block is used in the frontend #33989

View File

@ -52,7 +52,7 @@ class Homescreen {
add_filter( 'woocommerce_admin_preload_options', array( $this, 'preload_options' ) );
if ( Features::is_enabled( 'shipping-smart-defaults' ) ) {
if ( Features::is_enabled( 'shipping-smart-defaults' ) && function_exists( 'get_current_screen' ) ) {
add_filter(
'woocommerce_admin_shared_settings',
array( $this, 'maybe_set_default_shipping_options_on_home' ),