From 52a44f047b5330e05992eec3c4d42d0ee160114d Mon Sep 17 00:00:00 2001 From: Ionut Neagu Date: Tue, 16 Jun 2026 16:11:31 +0200 Subject: [PATCH] fix: repoint notice-dismiss callback to the method that exists Promotions::load() registered the notice-dismiss AJAX handler against `ThemeisleSDK\Modules\Notification::regular_dismiss`, a method that does not exist anywhere in the SDK (the real handler is `Notification::dismiss`, which the SDK already references for this same action elsewhere). On a non-Neve site (`themeisle_sdk_promotions_neve_installed !== true`) the gated branch registers this callback. When the broken callback is reached as a user dismisses a review/promo notice, WordPress calls it via WP_Hook (call_user_func_array) and PHP fatals: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class ThemeisleSDK\Modules\Notification does not have a method "regular_dismiss" The result is an HTTP 500 / blank admin page on dismiss. This affects every product bundling the SDK (verified across versions 3.3.x); Neve sites are spared only because the gate closes before the registration. Fix: point the callback at the existing `Notification::dismiss`. It is idempotent with the registration in `Notification::load()` (same static callback + priority de-dupes in WP_Hook), so behaviour is unchanged on sites that were never hitting the bug. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/Modules/Promotions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Modules/Promotions.php b/src/Modules/Promotions.php index eb46f164..7758be3d 100644 --- a/src/Modules/Promotions.php +++ b/src/Modules/Promotions.php @@ -209,7 +209,7 @@ public function load( $product ) { add_filter( 'themeisle_sdk_ran_promos', '__return_true' ); if ( get_option( $this->option_neve, false ) !== true ) { - add_action( 'wp_ajax_themeisle_sdk_dismiss_notice', 'ThemeisleSDK\Modules\Notification::regular_dismiss' ); + add_action( 'wp_ajax_themeisle_sdk_dismiss_notice', 'ThemeisleSDK\Modules\Notification::dismiss' ); } }