From dbc94903522b1e836b40c901f7783c32d39cf0ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Kj=C3=A6r=20Rasmussen?= Date: Wed, 17 Jan 2024 12:00:06 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Check=20if=20admin=20and=20if=20?= =?UTF-8?q?function=20exists?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/woocommerce/WC_Gateway_Economic_Invoice.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/woocommerce/WC_Gateway_Economic_Invoice.php b/src/woocommerce/WC_Gateway_Economic_Invoice.php index a0a2bb8..d7459ce 100644 --- a/src/woocommerce/WC_Gateway_Economic_Invoice.php +++ b/src/woocommerce/WC_Gateway_Economic_Invoice.php @@ -279,6 +279,10 @@ public function addEanFieldFisplayAdminOrderMeta($order): void public function isSettingsPage() { + if(! is_admin() || ! function_exists('get_current_screen')){ + return false; + } + $currentScreen = get_current_screen(); return $currentScreen->base === 'woocommerce_page_wc-settings' &&