diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 3c55f3f59a..8c4caa468d 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -1658,6 +1658,7 @@ function wp_check_php_version() { * @type bool $dismissible Optional. Whether the admin notice is dismissible. Default false. * @type string $id Optional. The value of the admin notice's ID attribute. Default empty string. * @type string[] $additional_classes Optional. A string array of class names. Default empty array. + * @type string[] $attributes Optional. Additional attributes for the notice div. Default empty array. * @type bool $paragraph_wrap Optional. Whether to wrap the message in paragraph tags. Default true. * } * @return string The markup for an admin notice. @@ -1668,6 +1669,7 @@ function wp_get_admin_notice( $message, $args = array() ) { 'dismissible' => false, 'id' => '', 'additional_classes' => array(), + 'attributes' => array(), 'paragraph_wrap' => true, ); @@ -1681,9 +1683,10 @@ function wp_get_admin_notice( $message, $args = array() ) { * @param array $args The arguments for the admin notice. * @param string $message The message for the admin notice. */ - $args = apply_filters( 'wp_admin_notice_args', $args, $message ); - $id = ''; - $classes = 'notice'; + $args = apply_filters( 'wp_admin_notice_args', $args, $message ); + $id = ''; + $classes = 'notice'; + $attributes = ''; if ( is_string( $args['id'] ) ) { $trimmed_id = trim( $args['id'] ); @@ -1721,11 +1724,24 @@ function wp_get_admin_notice( $message, $args = array() ) { $classes .= ' ' . implode( ' ', $args['additional_classes'] ); } + if ( is_array( $args['attributes'] ) && ! empty( $args['attributes'] ) ) { + $attributes = ''; + foreach ( $args['attributes'] as $attr => $val ) { + if ( is_bool( $val ) ) { + $attributes .= $val ? ' ' . $attr : ''; + } elseif ( is_int( $attr ) ) { + $attributes .= ' ' . esc_attr( trim( $val ) ); + } elseif ( $val ) { + $attributes .= ' ' . $attr . '="' . esc_attr( trim( $val ) ) . '"'; + } + } + } + if ( false !== $args['paragraph_wrap'] ) { $message = "

$message

"; } - $markup = sprintf( '
%3$s
', $id, $classes, $message ); + $markup = sprintf( '
%4$s
', $id, $classes, $attributes, $message ); /** * Filters the markup for an admin notice. diff --git a/wp-includes/kses.php b/wp-includes/kses.php index f6bd75741d..a707c62de2 100644 --- a/wp-includes/kses.php +++ b/wp-includes/kses.php @@ -2645,12 +2645,14 @@ function _wp_add_global_attributes( $value ) { 'aria-describedby' => true, 'aria-details' => true, 'aria-expanded' => true, + 'aria-hidden' => true, 'aria-label' => true, 'aria-labelledby' => true, - 'aria-hidden' => true, + 'aria-live' => true, 'class' => true, 'data-*' => true, 'dir' => true, + 'hidden' => true, 'id' => true, 'lang' => true, 'style' => true, diff --git a/wp-includes/version.php b/wp-includes/version.php index 9fb4cdfe1b..4f3468fc75 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56602'; +$wp_version = '6.4-alpha-56603'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.