diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index 8f6ec1cef4e26..8ed4dfd11e1ab 100644
--- a/src/wp-includes/media.php
+++ b/src/wp-includes/media.php
@@ -3468,9 +3468,10 @@ function wp_audio_shortcode( $attr, $content = '' ) {
$primary = false;
if ( ! empty( $atts['src'] ) ) {
- $type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
+ $type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
+ $has_extension = (bool) pathinfo( wp_parse_url( $atts['src'], PHP_URL_PATH ), PATHINFO_EXTENSION );
- if ( ! in_array( strtolower( $type['ext'] ), $default_types, true ) ) {
+ if ( $has_extension && ! in_array( strtolower( $type['ext'] ), $default_types, true ) ) {
return sprintf( '%s', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
}
@@ -3567,7 +3568,6 @@ function wp_audio_shortcode( $attr, $content = '' ) {
$html = sprintf( '