From 954afd1571c7913dea2d31b53445b1fce3a51e9b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 12 Feb 2018 22:35:56 +0000 Subject: [PATCH] Media: In `img_caption_shortcode()`, make sure `$id` and `$caption_id` are always defined. See #34595. git-svn-id: https://develop.svn.wordpress.org/trunk@42706 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/media.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index ade1114d16..8965da9ac2 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1560,6 +1560,8 @@ function img_caption_shortcode( $attr, $content = null ) { return $content; } + $id = $caption_id = $describedby = ''; + if ( $atts['id'] ) { $atts['id'] = sanitize_html_class( $atts['id'] ); $id = 'id="' . esc_attr( $atts['id'] ) . '" '; @@ -1571,8 +1573,6 @@ function img_caption_shortcode( $attr, $content = null ) { $atts['caption_id'] = 'caption-' . str_replace( '_', '-', $atts['id'] ); } - $describedby = ''; - if ( $atts['caption_id'] ) { $caption_id = 'id="' . esc_attr( $atts['caption_id'] ) . '" '; $describedby = 'aria-describedby="' . esc_attr( $atts['caption_id'] ) . '" ';