From e07e95e232c7598d59b1897498b608b0d2c31736 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 29 Aug 2023 15:35:21 +0000 Subject: [PATCH] Media: Prevent warning if `[caption]` shortcode is used without attributes. Props maltfield, aslamdoctor. Fixes #59206. Built from https://develop.svn.wordpress.org/trunk@56488 git-svn-id: http://core.svn.wordpress.org/trunk@56000 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index e037a0608b..d365e0b1e1 100644 --- a/wp-includes/media.php +++ b/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 ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 40711286e7..2307a489e9 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.4-alpha-56484'; +$wp_version = '6.4-alpha-56488'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.