WordPress.org

Make WordPress Core

Ticket #51122: 51122.diff

File 51122.diff, 1.6 KB (added by audrasjb, 13 months ago)

Media: Add proper documentation about the use of the loading attribute in the attr parameter of wp_get_attachment_image

  • src/wp-includes/media.php

    diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
    index 1871678fad..9cae8aac0c 100644
    a b function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon 
    10101010 * @param string|array $attr {
    10111011 *     Optional. Attributes for the image markup.
    10121012 *
    1013  *     @type string $src    Image attachment URL.
    1014  *     @type string $class  CSS class name or space-separated list of classes.
    1015  *                          Default `attachment-$size_class size-$size_class`,
    1016  *                          where `$size_class` is the image size being requested.
    1017  *     @type string $alt    Image description for the alt attribute.
    1018  *     @type string $srcset The 'srcset' attribute value.
    1019  *     @type string $sizes  The 'sizes' attribute value.
     1013 *     @type string      $src     Image attachment URL.
     1014 *     @type string      $class   CSS class name or space-separated list of classes.
     1015 *                                Default `attachment-$size_class size-$size_class`,
     1016 *                                where `$size_class` is the image size being requested.
     1017 *     @type string      $alt     Image description for the alt attribute.
     1018 *     @type string      $srcset  The 'srcset' attribute value.
     1019 *     @type string      $sizes   The 'sizes' attribute value.
     1020 *     @type string|bool $loading The `loading` attribute value. Returning a value of false will result in the
     1021 *                                attribute being omitted for the image. Default is `lazy`.
    10201022 * }
    10211023 * @return string HTML img element or empty string on failure.
    10221024 */