After [35402], don't unnecessary run `wp_get_attachment_image_srcset()` and `wp_get_attachment_image_sizes()` in `wp_get_attachment_image()` if `srcset` is passed as an argument.
See #34379. Built from https://develop.svn.wordpress.org/trunk@35404 git-svn-id: http://core.svn.wordpress.org/trunk@35368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e3989c6194
commit
1e59e53dd2
|
@ -809,16 +809,19 @@ function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = fa
|
|||
if ( empty($default_attr['alt']) )
|
||||
$default_attr['alt'] = trim(strip_tags( $attachment->post_title )); // Finally, use the title
|
||||
|
||||
$attr = wp_parse_args( $attr, $default_attr );
|
||||
$srcset = wp_get_attachment_image_srcset( $attachment_id, $size );
|
||||
$sizes = wp_get_attachment_image_sizes( $attachment_id, $size, $width );
|
||||
$attr = wp_parse_args( $attr, $default_attr );
|
||||
|
||||
// Generate srcset and sizes if not already present.
|
||||
if ( empty( $attr['srcset'] ) && $srcset && $sizes ) {
|
||||
$attr['srcset'] = $srcset;
|
||||
if ( empty( $attr['srcset'] ) ) {
|
||||
$srcset = wp_get_attachment_image_srcset( $attachment_id, $size );
|
||||
$sizes = wp_get_attachment_image_sizes( $attachment_id, $size, $width );
|
||||
|
||||
if ( empty( $attr['sizes'] ) ) {
|
||||
$attr['sizes'] = $sizes;
|
||||
if ( $srcset && $sizes ) {
|
||||
$attr['srcset'] = $srcset;
|
||||
|
||||
if ( empty( $attr['sizes'] ) ) {
|
||||
$attr['sizes'] = $sizes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-beta1-35403';
|
||||
$wp_version = '4.4-beta1-35404';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue