[wp-trac] [WordPress Trac] #57791: Create function to output admin notices
WordPress Trac
noreply at wordpress.org
Tue Mar 7 19:18:28 UTC 2023
#57791: Create function to output admin notices
-------------------------------------------------+-------------------------
Reporter: joedolson | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Administration | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests dev- | Focuses:
feedback | administration
-------------------------------------------------+-------------------------
Comment (by joedolson):
The logic in your update doesn't totally match the original, since in the
original the foreach loops over all messages and then echos the whole
output, vs. outputting each message as it comes.
That said, I can't see any particular reason that would matter.
I also think that as part of adding this function, we should provide a
returning and an echoing option, for future flexibility. This function
would be quite useful for plugin authors, but I know that I wouldn't be
able to use it for all notices if it only echoes. That probably means
wp_get_admin_notice() would contain the logic you've provided and
wp_admin_notice() would just call the getter.
But I definitely like getting rid of a bunch of string appending. :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57791#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list