Ajaxify cache purge notice dismissal #167
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ajaxify Cache Purging Notice ✅
Implementation complete!
includes/admin/notices.phpSummary
This PR adds AJAX functionality to the cache purge notice that appears after plugin activation/deactivation.
Changes Made
1. Added AJAX Handler (
dismiss_notice_ajax())manage_options)2. Updated Notice Display (
maybe_display_purge_cache_plugin_notice())data-notice-idanddata-nonceattributespowered-cache-dismissible-noticefor targetingpowered-cache-dismiss-buttonto secondary dismiss button3. Inline JavaScript Implementation
.notice-dismiss(X button) and.powered-cache-dismiss-buttonKey Features
✅ Notice dismisses without page reload
✅ Works with both "X" button and "Dismiss this notice" button
✅ Smooth fade-out animation for better UX
✅ Proper nonce verification for security
✅ Graceful fallback if JavaScript disabled
✅ Works on all admin pages (dashboard, plugins, etc.)
✅ No new JS file needed (inline script)
✅ No external dependencies
✅ PHPCS clean (no errors or warnings)
Testing Notes
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.