Make WordPress Core


Ignore:
Timestamp:
07/06/2023 04:31:02 PM (10 months ago)
Author:
flixos90
Message:

Media: Ensure that the image widget supports loading optimization attributes.

This changeset adds support for loading optimization attributes such as loading="lazy" and fetchpriority="high" to the image widget. A new context widget_media_image is introduced for that purpose.

Props spacedmonkey, thekt12, mukesh27, westonruter.
Fixes #58704.
See #58235.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r56143 r56154  
    56635663
    56645664    // Special handling for programmatically created image tags.
    5665     if ( 'the_post_thumbnail' === $context || 'wp_get_attachment_image' === $context ) {
     5665    if ( 'the_post_thumbnail' === $context || 'wp_get_attachment_image' === $context || 'widget_media_image' === $context ) {
    56665666        /*
    56675667         * Skip programmatically created images within post content as they need to be handled together with the other
Note: See TracChangeset for help on using the changeset viewer.