mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 15:16:59 +00:00
Shortcodes: Always return an array in shortcode_parse_atts().
Previously, `shortcode_parse_atts()` would return the input (an empty string) if a shortcode had no attributes, even though the documentation said otherwise. Always returning an (empty) array reduces confusion and improves developer experience as the return value does not have to be manually checked in the shortcode itself. Props: nicolefurlan, swissspidy, johnbillion, bedas. Fixes #59249. git-svn-id: https://develop.svn.wordpress.org/trunk@57597 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2354,10 +2354,6 @@ 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