DataView: add notices config to suppress built-in save notices#44
Merged
Conversation
When a DataView page lives under the WordPress "Settings" menu, core's options-head.php already renders a native "Settings saved." notice for the `updated=1` redirect (its documented back-compat path for plugins that don't use the Settings API). DataView's own render_notices() also fires on `?updated`, so the notice appears twice — one plain notice and one with id="setting-error-settings_updated". Add a `notices` config option (default true). When false, render_notices() returns early, letting the host environment own save notices. Error/validation output (render_errors) is a separate path and unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
When a
DataViewpage lives under the WordPress Settings menu, two "Settings saved." notices appear after every save:WordPress core — for pages under
options-general.php,admin-header.phpincludeswp-admin/options-head.php, whose back-compat block fires for?page=...&updated=1:This is the native notice with
id="setting-error-settings_updated". DataView's redirect (updated=1) is exactly the case this path was written for.DataView —
RequestRouter::render_notices()also fires onisset($_GET['updated']), echoing a second notice in the page body.Both key on the same
?updatedparam, so a consumer can't suppress just one.Change
Add a
noticesconfig option (bool, defaulttrue). Whenfalse,render_notices()returns early, letting the host environment own save notices:Validation/error output (
render_errors()) is a separate path and is unaffected.Tests
4 new tests: config default (
true), config override (false), andrender_notices()output present-when-enabled / empty-when-disabled. Full suite: 274 passing, 1 pre-existing unrelated skip.🤖 Generated with Claude Code