[wp-trac] [WordPress Trac] #50425: Do not lazy-load images which are very likely to be in the initial viewport
WordPress Trac
noreply at wordpress.org
Thu Jun 18 19:00:43 UTC 2020
#50425: Do not lazy-load images which are very likely to be in the initial viewport
-------------------------+------------------------------------------
Reporter: flixos90 | Owner: flixos90
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.5
Component: Media | Version:
Severity: normal | Keywords: needs-patch needs-unit-tests
Focuses: |
-------------------------+------------------------------------------
Currently, `loading="lazy"` is added to the following images by default:
* images in post content (context `the_content`)
* images in post excerpt (context `the_excerpt`)
* images in widget content (context `widget_text_content`)
* avatar images (context `get_avatar`)
* any image rendered via `wp_get_attachment_image()` (context
`wp_get_attachment_image`)
While these defaults can be modified per context via the
`wp_lazy_loading_enabled` filter, there are certain images in WordPress
which preferably would not be lazy-loaded since they are very likely to be
in the initial viewport. This ticket aims at modifying those images to use
`loading="eager"` by default instead.
The following functions should pass `loading="eager"` to
`wp_get_attachment_image()`:
* `get_custom_logo()`
* `get_the_post_thumbnail()`
Another function to cover would be `get_header_image_tag()`, however that
does not use `wp_get_attachment_image()`, so no need to update.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50425>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list