diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php index 15f2173d1f..0f53494bb0 100644 --- a/wp-includes/media-template.php +++ b/wp-includes/media-template.php @@ -353,6 +353,9 @@ function wp_print_media_templates() { + diff --git a/wp-includes/media.php b/wp-includes/media.php index be7d099607..9d43a65446 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -778,7 +778,13 @@ function gallery_shortcode($attr) { $i = 0; foreach ( $attachments as $id => $attachment ) { - $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false); + if ( ! empty( $attr['link'] ) && 'file' === $attr['link'] ) + $image_output = wp_get_attachment_link( $id, $size, false, false ); + elseif ( ! empty( $attr['link'] ) && 'none' === $attr['link'] ) + $image_output = wp_get_attachment_image( $id, $size, false ); + else + $image_output = wp_get_attachment_link( $id, $size, true, false ); + $image_meta = wp_get_attachment_metadata( $id ); $orientation = ''; @@ -788,7 +794,7 @@ function gallery_shortcode($attr) { $output .= "<{$itemtag} class='gallery-item'>"; $output .= " <{$icontag} class='gallery-icon {$orientation}'> - $link + $image_output "; if ( $captiontag && trim($attachment->post_excerpt) ) { $output .= "