diff --git a/wp-includes/media.php b/wp-includes/media.php
index 09e06308c8..42a9825dc6 100644
--- a/wp-includes/media.php
+++ b/wp-includes/media.php
@@ -2428,7 +2428,7 @@ function get_the_post_format_image( $attached_size = 'full', &$post = null ) {
// wrap image in
if ( ! empty( $meta['url'] ) )
$image = sprint( $link_fmt, $image );
- } elseif ( has_shortcode( $meta['image'], 'gallery' ) ) {
+ } elseif ( has_shortcode( $meta['image'], 'caption' ) ) {
// wrap in
if ( ! empty( $meta['url'] ) && false === strpos( $meta['image'], ' in
+ if ( ! empty( $meta['url'] ) && false === strpos( $meta['image'], ']+>)#',
+ sprintf( '$1', esc_url( $meta['url'] ) ),
+ $meta['image']
+ );
+ }
+ $format_output .= do_shortcode( $meta['image'] );
+ } else {
+
+ if ( is_numeric( $meta['image'] ) ) {
+ $image = wp_get_attachment_image( absint( $meta['image'] ), 'full' );
+ } elseif ( ! preg_match( '#<[^>]+>#', $meta['image'] ) ) {
+ // not HTML, assume URL
+ $image = sprintf(
'',
empty( $compat['image_class'] ) ? '' : sprintf( 'class="%s" ', esc_attr( $compat['image_class'] ) ),
- $image
+ esc_url( $meta['image'] )
);
} else {
- $image_html = $image;
+ // assume HTML
+ $image = $meta['image'];
}
- if ( empty( $meta['url'] ) || false !== strpos( $image, '%s',
esc_url( $meta['url'] ),
- $image_html
+ $image
);
+ } else {
+ $format_output .= $image;
}
}
}