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
This commit is contained in:
parent
aee17a059f
commit
954afd1571
|
@ -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'] ) . '" ';
|
||||
|
|
Loading…
Reference in New Issue