Skip to content

Commit

Permalink
Fix: wp_audio_shortcode, handle boolean attribute correctly in foreach
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham Kumar Bansal committed Jun 26, 2024
1 parent 0361f9a commit 5b8e179
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down

0 comments on commit 5b8e179

Please sign in to comment.