From 03731c64d503b277bec485ef89c9e5a62bcac3ce Mon Sep 17 00:00:00 2001 From: Chi-Hsuan Huang Date: Thu, 12 May 2022 09:24:08 +0800 Subject: [PATCH] Fix notice on emptry product page --- .../src/Admin/Features/OnboardingTasks/Tasks/Products.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Products.php b/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Products.php index 7a78bf41c2e..72dd99e3df3 100644 --- a/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Products.php +++ b/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Products.php @@ -158,8 +158,7 @@ class Products extends Task { * @param string $hook Page hook. */ public function possibly_add_load_sample_return_notice_script( $hook ) { - global $post; - if ( 'edit.php' !== $hook || 'product' !== $post->post_type ) { + if ( 'edit.php' !== $hook || 'product' !== get_query_var( 'post_type' ) ) { return; }