Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wp_audio_shortcode() outputs invalid HTML #6917

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -3355,10 +3355,10 @@ function wp_audio_shortcode( $attr, $content = '' ) {
}
}

$attr_strings = array();

foreach ( $html_atts as $k => $v ) {
$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
$audio_tag_builder = new WP_HTML_Tag_Processor( '<audio controls>' );
$audio_tag_builder->next_tag();
foreach ( $html_atts as $name => $value ) {
$audio_tag_builder->set_attribute( $name, $value );
}

$html = '';
Expand All @@ -3367,7 +3367,7 @@ function wp_audio_shortcode( $attr, $content = '' ) {
$html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
}

$html .= sprintf( '<audio %s controls="controls">', implode( ' ', $attr_strings ) );
$html .= $audio_tag_builder->get_updated_html();

$fileurl = '';
$source = '<source type="%s" src="%s" />';
Expand Down
Loading