diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index e037a0608b..d365e0b1e1 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -2361,6 +2361,10 @@ add_shortcode( 'caption', 'img_caption_shortcode' ); * @return string HTML content to display the caption. */ function img_caption_shortcode( $attr, $content = '' ) { + if ( ! $attr ) { + $attr = array(); + } + // New-style shortcode with the caption inside the shortcode with the link and image tags. if ( ! isset( $attr['caption'] ) ) { if ( preg_match( '#((?:]+>\s*)?]+>(?:\s*)?)(.*)#is', $content, $matches ) ) {