diff --git a/wp-includes/media.php b/wp-includes/media.php index c640d47d02..2fc2e6e63a 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -3482,8 +3482,20 @@ function wp_audio_shortcode( $attr, $content = '' ) { $attr_strings = array(); - foreach ( $html_atts as $k => $v ) { - $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; + foreach ( $html_atts as $attribute_name => $attribute_value ) { + if ( in_array( $attribute_name, array( 'loop', 'autoplay', 'muted' ), true ) && true === $attribute_value ) { + // Add boolean attributes without their value for true. + $attr_strings[] = esc_attr( $attribute_name ); + } elseif ( 'preload' === $attribute_name && ! empty( $attribute_value ) ) { + // Handle the preload attribute with specific allowed values. + $allowed_preload_values = array( 'none', 'metadata', 'auto' ); + if ( in_array( $attribute_value, $allowed_preload_values, true ) ) { + $attr_strings[] = sprintf( '%s="%s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) ); + } + } elseif ( ! empty( $attribute_value ) ) { + // For non-boolean attributes, add them with their value. + $attr_strings[] = sprintf( '%s="%s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) ); + } } $html = ''; diff --git a/wp-includes/version.php b/wp-includes/version.php index 9d39c3040d..813a2837b8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-beta1-59953'; +$wp_version = '6.8-beta1-59954'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.