Skip to content

Commit 45272e1

Browse files
authored
fix: when doing a rest api call, a php error stackable_add_welcome_notification is undefined can trigger (#3579)
Co-authored-by: [email protected] <>
1 parent 398f38b commit 45272e1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/pro.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ class Stackable_Go_Premium_Notification {
8787
const OLD_TIMER_NOTICE_TIME = 604800; // 7 * 24 * 60 * 60
8888

8989
function __construct() {
90-
add_action( 'admin_menu', array( $this, 'check_pro_notice_date' ), 9 );
91-
add_action( 'admin_menu', array( $this, 'go_premium_notice_old_raters' ), 9 );
90+
if ( is_admin() ) {
91+
add_action( 'admin_menu', array( $this, 'check_pro_notice_date' ), 9 );
92+
add_action( 'admin_menu', array( $this, 'go_premium_notice_old_raters' ), 9 );
93+
}
9294
}
9395

9496
/**

src/welcome/notification-rate.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class Stackable_Welcome_Notification_Rate {
2121
const RATING_NOTICE_TIME = 432000; // 5 * 24 * 60 * 60
2222

2323
function __construct() {
24-
add_action( 'admin_menu', array( $this, 'check_activation_date' ), 9 );
24+
if ( is_admin() ) {
25+
add_action( 'admin_menu', array( $this, 'check_activation_date' ), 9 );
26+
}
2527
}
2628

2729
/**

0 commit comments

Comments
 (0)