diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 0a8621d209815..57d6af61e48a5 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -3358,7 +3358,11 @@ function wp_audio_shortcode( $attr, $content = '' ) { $attr_strings = array(); foreach ( $html_atts as $k => $v ) { - $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; + if ( in_array( $k, array( 'loop', 'autoplay', 'muted' ), true ) && true === $v ) { + $attr_strings[] = esc_attr( $k ); + } else { + $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; + } } $html = '';