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
This commit is contained in:
Pascal Birchler 2023-08-29 15:35:21 +00:00
parent cf6042fa3a
commit e07e95e232
2 changed files with 5 additions and 1 deletions

View File

@ -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( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {

View File

@ -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.