diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index d4b43494c7..95bbca732e 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -896,7 +896,7 @@ function img_caption_shortcode( $attr, $content = null ) { return $content; if ( ! empty( $atts['id'] ) ) - $atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" '; + $atts['id'] = 'id="' . esc_attr( sanitize_html_class( $atts['id'] ) ) . '" '; $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );