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

See #34595.

git-svn-id: https://develop.svn.wordpress.org/trunk@42692 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2018-02-11 14:52:03 +00:00
parent 10ee22ee46
commit b66da520b3
1 changed files with 3 additions and 2 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' );