[wp-trac] [WordPress Trac] #31000: Multiple calls to settings_errors() result in duplicate display of notices
WordPress Trac
noreply at wordpress.org
Tue Jan 13 09:07:29 UTC 2015
#31000: Multiple calls to settings_errors() result in duplicate display of notices
----------------------------+-----------------------------
Reporter: jrf | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 3.9
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
`settings_errors()` is called by default on options pages and numerous
plugins and themes whose pages aren't under the options submenu will also
call it.
Good, maybe even great, as so many have obviously adopted to using this.
The issue arises when, for instance, a plugin uses a call to
`settings_errors()` hooked into `admin_notices` to display their notices
across all pages. In that case, their message will be displayed twice on
any pages also calling `settings_errors()`.
Now a plugin can check if they are on an options page and - knowing that
the messages will be displayed there anyhow - forgo the call to
`settings_errors( 'my-messages' )` there. But there is no way for a plugin
to test if another theme/plugin outside of the options pages is also
making the `settings_errors()` call.
I would suggest unsetting any messages which are displayed from within the
settings_errors() call to avoid duplicate messages ever being shown.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31000>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list