mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-30 23:30:05 +00:00
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
This commit is contained in:
@@ -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 ) ) {
|
||||
|
||||
Reference in New Issue
Block a user