Skip to content

Commit ec94944

Browse files
committed
Media: Prevent warning if [caption] shortcode is used without attributes.
Props maltfield, aslamdoctor. Fixes #59206. git-svn-id: https://develop.svn.wordpress.org/trunk@56488 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 61cd1a5 commit ec94944

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/wp-includes/media.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,10 @@ function _wp_post_thumbnail_context_filter_remove() {
23612361
* @return string HTML content to display the caption.
23622362
*/
23632363
function img_caption_shortcode( $attr, $content = '' ) {
2364+
if ( ! $attr ) {
2365+
$attr = array();
2366+
}
2367+
23642368
// New-style shortcode with the caption inside the shortcode with the link and image tags.
23652369
if ( ! isset( $attr['caption'] ) ) {
23662370
if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {

0 commit comments

Comments
 (0)