Media: Make sure $caption_id does not depend on an undefined variable.

See #34595.
Built from https://develop.svn.wordpress.org/trunk@42692


git-svn-id: http://core.svn.wordpress.org/trunk@42520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2018-02-11 14:53:30 +00:00
parent 3e19b66f40
commit dffe5deb97
2 changed files with 4 additions and 3 deletions

View File

@@ -1556,13 +1556,14 @@ function img_caption_shortcode( $attr, $content = null ) {
return $content;
}
$caption_id = '';
if ( ! empty( $atts['id'] ) ) {
$att_id = esc_attr( sanitize_html_class( $atts['id'] ) );
$atts['id'] = 'id="' . $att_id . '" ';
$caption_id = 'caption-' . str_replace( '_', '-', $att_id );
}
$caption_id = 'caption-' . str_replace( '_', '-', $att_id );
$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
$html5 = current_theme_supports( 'html5', 'caption' );