Skip to content

Commit 86f5034

Browse files
Update add_settings_error() and settings_errors() to improve ARIA live attribute handling
1 parent 71b6cc2 commit 86f5034

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/wp-admin/includes/template.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,11 +1859,11 @@ function do_settings_fields( $page, $section ) {
18591859
* @param string $setting Slug title of the setting to which this error applies.
18601860
* @param string $code Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
18611861
* @param string $message The formatted message text to display to the user (will be shown inside styled
1862-
* `<div>` and `<p>` tags).
1863-
* @param string $type Optional. Message type, controls HTML class. Possible values include 'error',
1864-
* 'success', 'warning', 'info'. Default 'error'.
1862+
* `<div>` and `<p>` tags).
1863+
* @param string $type Optional. Message type, controls HTML class. Possible values include 'error',
1864+
* 'success', 'warning', 'info'. Default 'error'.
18651865
* @param string $aria_live Optional. The ARIA live attribute value. Possible values include 'off', 'polite',
1866-
* 'assertive'. Default empty string which doesn't add the attribute.
1866+
* 'assertive'. Default empty string which doesn't add the attribute.
18671867
*/
18681868
function add_settings_error( $setting, $code, $message, $type = 'error', $aria_live = '' ) {
18691869
global $wp_settings_errors;
@@ -2014,7 +2014,7 @@ function settings_errors( $setting = '', $sanitize = false, $hide_on_update = fa
20142014
);
20152015

20162016
$aria_live_attr = '';
2017-
if ( ! empty( $details['aria_live'] ) && in_array( $details['aria_live'], array( 'off', 'polite', 'assertive' ), true ) ) {
2017+
if ( in_array( $details['aria_live'], array( 'off', 'polite', 'assertive' ), true ) ) {
20182018
$aria_live_attr = sprintf( ' aria-live="%s"', esc_attr( $details['aria_live'] ) );
20192019
}
20202020

0 commit comments

Comments
 (0)