diff --git a/src/DonationForms/V2/DonationFormsAdminPage.php b/src/DonationForms/V2/DonationFormsAdminPage.php index 796f52d234..6807b0a034 100644 --- a/src/DonationForms/V2/DonationFormsAdminPage.php +++ b/src/DonationForms/V2/DonationFormsAdminPage.php @@ -269,13 +269,14 @@ public static function isShowing(): bool /** * Helper function to determine if current page is the edit v2 form page * + * @unreleased added global $post to isset * @since 3.0.0 * * @return bool */ private function isShowingEditV2FormPage(): bool { - return isset($_GET['action']) && $_GET['action'] === 'edit' && $GLOBALS['post']->post_type === 'give_forms'; + return isset($_GET['action'], $GLOBALS['post']) && $_GET['action'] === 'edit' && $GLOBALS['post']->post_type === 'give_forms'; } /** diff --git a/src/Promotions/InPluginUpsells/LegacyFormEditor.php b/src/Promotions/InPluginUpsells/LegacyFormEditor.php index b8fec39bd3..cc336d95e6 100644 --- a/src/Promotions/InPluginUpsells/LegacyFormEditor.php +++ b/src/Promotions/InPluginUpsells/LegacyFormEditor.php @@ -48,18 +48,15 @@ public function renderDonationOptionsRecurringRecommendation() } /** - * + * @unreleased replaced logic to be give_forms post_type specific * @since 2.27.1 - * */ public static function isShowing(): bool { - $queryParameters = $_GET; - - if (isset($queryParameters['action']) && $queryParameters['action'] === 'edit' && $queryParameters['post']) { - return true; - } + global $post, $pagenow; - return false; + return $post && + in_array($pagenow, ['post-new.php', 'post.php'], true) && + 'give_forms' === get_post_type($post); } }