[wp-trac] [WordPress Trac] #50442: Add prefixes to all admin notices (Warning, Error, Success, Info)
WordPress Trac
noreply at wordpress.org
Tue Aug 6 15:50:45 UTC 2024
#50442: Add prefixes to all admin notices (Warning, Error, Success, Info)
-------------------------------------+-------------------------------------
Reporter: kebbet | Owner: joedolson
Type: enhancement | Status: accepted
Priority: normal | Milestone: 6.7
Component: Administration | Version:
Severity: normal | Resolution:
Keywords: needs-design needs- | Focuses: ui, accessibility, ui-
patch early | copy
-------------------------------------+-------------------------------------
Comment (by alexstine):
I certainly agree this would be informative for all users. I think while a
dev note could be added to instruct authors to remove the prefix, I assume
it probably isn't super important. Couldn't we just do something like
this?
{{{#!php
<?php
$error_prefix = __( 'Error' );
$check_error_prefix = preg_match( '/^Error/', $admin_notice_content );
if ( $check_error_prefix === 1 ) {
return sprintf( '<span class="screen-reader-text">%s: </span>%s',
$error_prefix, $admin_notice_content );
}
}}}
My PHP is a bit rusty but I think the meaning is understood.
Thanks.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50442#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list