You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When this is rendered on the frontend, the first IMG tag always gets fetchpriority=high in WordPress, due to the logic in wp_get_loading_optimization_attributes() and wp_maybe_add_fetchpriority_high_attr():
This is problematic because in this example, the image for the mobile viewport always gets loaded with a high priority even though it is not displayed at all on desktop or tablet viewports.
This is similar to the issue of IMG elements which appear in the Navigation Overlay:
The difference here is that images in the Navigation Overlay must always have fetchpriority=low because they are never in the critical rendering path. In contrast, images in blocks which have viewport-specific visibility may be in the critical rendering path: one may even be the LCP element. But since there is no way to know this server-side, there needs to be a way for the rendered block to indicate that WordPress should not add fetchpriority=high to the IMG when it is processed. This can be achieved by adding fetchpriority=auto.
Step-by-step reproduction instructions
Add an Image block with a large image size to a post.
Configure block visibility to hide the block one or two viewports.
See that the IMG on the frontend has fetchpriority=high, which may be erroneous.
Description
Consider block visibility to show a different hero image on mobile versus tablet versus desktop, with this block markup:
Screen.Recording.2026-03-08.at.18.42.32.mov
(Related: #76275)
When this is rendered on the frontend, the first
IMGtag always getsfetchpriority=highin WordPress, due to the logic inwp_get_loading_optimization_attributes()andwp_maybe_add_fetchpriority_high_attr():Rendered Post Content
This is problematic because in this example, the image for the mobile viewport always gets loaded with a high priority even though it is not displayed at all on desktop or tablet viewports.
This is similar to the issue of
IMGelements which appear in the Navigation Overlay:fetchpriority=highand degrade LCP metric for page #76181The difference here is that images in the Navigation Overlay must always have
fetchpriority=lowbecause they are never in the critical rendering path. In contrast, images in blocks which have viewport-specific visibility may be in the critical rendering path: one may even be the LCP element. But since there is no way to know this server-side, there needs to be a way for the rendered block to indicate that WordPress should not addfetchpriority=highto theIMGwhen it is processed. This can be achieved by addingfetchpriority=auto.Step-by-step reproduction instructions
IMGon the frontend hasfetchpriority=high, which may be erroneous.Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.