| @@ -142,8 +142,11 @@ | ||
| 142 | 142 | * |
| 143 | 143 | * @return bool True if on MetaSync admin page. |
| 144 | 144 | */ |
| 145 | 145 | private function is_metasync_admin_page() { |
| 146 | + if ( ! function_exists( 'get_current_screen' ) ) { | |
| 147 | + return false; | |
| 148 | + } | |
| 146 | 149 | $screen = get_current_screen(); |
| 147 | 150 | |
| 148 | 151 | if (!$screen) { |
| 149 | 152 | return false; |
| @@ -150,9 +153,9 @@ | ||
| 150 | 153 | } |
| 151 | 154 | |
| 152 | 155 | // Check if on MetaSync settings page or any page with metasync in the ID |
| 153 | 156 | return strpos($screen->id, 'metasync') !== false || |
| 154 | - (isset($_GET['page']) && strpos($_GET['page'], 'metasync') !== false); | |
| 157 | + (isset($_GET['page']) && strpos($_GET['page'], 'metasync') !== false); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only page check to scope notice scripts | |
| 155 | 158 | } |
| 156 | 159 | |
| 157 | 160 | /** |
| 158 | 161 | * Enqueue admin scripts for notice handling |
| @@ -214,15 +217,8 @@ | ||
| 214 | 217 | |
| 215 | 218 | if (empty($endpoint_hash)) { |
| 216 | 219 | wp_send_json_error(['message' => 'Invalid endpoint hash']); |
| 217 | 220 | } |
| 218 | - | |
| 219 | - // Log the dismissal (notice will reappear on page refresh if still active) | |
| 220 | - error_log(sprintf( | |
| 221 | - '[MetaSync API_BACKOFF_NOTICE_DISMISSED] User %d dismissed notice for endpoint: %s', | |
| 222 | - get_current_user_id(), | |
| 223 | - $endpoint_hash | |
| 224 | - )); | |
| 225 | 221 | |
| 226 | 222 | wp_send_json_success(['message' => 'Notice dismissed']); |
| 227 | 223 | } |
| 228 | 224 | |