feat(updates): [SITE-5883] Add dismiss option to WordPress update notice - #121
Merged
Conversation
Make the upstream update notice dismissible per user, keyed to the available WordPress version so it stays dismissed until a newer version is released. Adds an AJAX handler (nonce + user-meta), a small dismiss script that persists the native is-dismissible click, and a render gate. Covered by phpunit (gate + handler) and BDD scenarios (dismiss, persist across reload, reappear on new version) on the existing e2e harness.
mehta-asim
marked this pull request as draft
July 13, 2026 22:02
Contributor
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 8 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Adding is-dismissible to the notice moved the pantheon-update-notice class token, breaking the adjacency assertion in the pre-existing targeting-hooks test; assert the class token order-independently instead. Declare the wp_localize_script global pantheonUpdateNotice for the linter (Codacy no-undef).
The After-hook cleanup interpolated process.env.WP_USER into the wp command, an unsanitized env-var to shell flow (CodeQL: indirect uncontrolled command line). Route it through a throwing allowlist guard, matching how SITE/SOURCE_ENV are already validated.
mehta-asim
marked this pull request as ready for review
July 13, 2026 22:23
jazzsequence
previously approved these changes
Jul 14, 2026
pwtyler
previously approved these changes
Jul 14, 2026
Per Ander: hide selectors behind a semantic step (the update notice should offer a dismiss option), and set the dismissed state directly via user meta in the reappear scenario instead of re-driving the dismiss UI (already covered by the persist scenario).
ander-murane
approved these changes
Jul 14, 2026
4 tasks
pwtyler
approved these changes
Jul 14, 2026
Merged
This was referenced Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
is-dismissibleclass, but WordPress's native dismiss is client-side only, so the notice returned on the next page load (the GitHub Add option to dismiss WordPress update notice in the admin dash #116 complaint).pantheon_dismissed_update_notice). A newer available version no longer matches the stored value, so the notice returns automatically. No stale-meta cleanup needed (one key, overwritten).wp_ajax_pantheon_dismiss_update_noticehandler (nonce +update_user_meta; the target version is resolved server-side, not trusted from the client) and a small script that fires on the native dismiss click._pantheon_upstream_update_notice()that skips the notice when the user's dismissed version equals the current available version.Context
SITE-5883
Community feedback (GitHub #116): the update notice is persistent and reappears on every admin page load. Maintainer guidance on that issue confirmed the fix must use user meta keyed to the version (client-side
is-dismissiblealone does not persist).Builds on SITE-5884 (#119, merged): reuses the
_pantheon_render_notice()dismissiblesupport and the playwright-bdd e2e harness._pantheon_render_notice()and the otherdismissiblecallsites (multisite-finalize, page-cache) are intentionally left untouched — persistence is wired only at the update-notice callsite.Changes
inc/pantheon-updates.phpdismissible => trueon the update-available notice;wp_ajax_pantheon_dismiss_update_noticehandler; enqueue + localize; two shared constsinc/assets/js/pantheon-update-notice-dismiss.jstests/phpunit/test-pantheon-updates.phptests/phpunit/test-pantheon-update-notice-dismiss.phptests/e2e/Testing
Local wp-env (browser, Playwright-driven):
Automated: phpunit (gate + handler) and BDD (dismiss / persist-across-reload / reappear) run in CI.
Test plan
Open items
References