-
Couldn't load subscription status.
- Fork 67
Description
Describe the bug
In the newspack_post_thumbnail() template tag, there's a chance that the default attributes being set can contain both loading="lazy" and fetchpriority="high". This will trigger a warning when the wp_get_loading_optimization_attributes() Core function is called since images that are lazy loaded should not be marked as high priority at the same time.
To Reproduce
Steps to reproduce the behavior:
- Create a few posts with featured image
- Visit the post archive page on the frontend
- With
WP_Debugenabled, the following warning message should be displayed -Notice: Function wp_get_loading_optimization_attributes was called <strong>incorrectly</strong>. An image should not be lazy-loaded and marked as high priority at the same time. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.3.0.)...
Screenshots
Markup of a post featured image in the archive page that contains both the loading="lazy" and fetchpriority="high" attributes

Warning message from Query monitor (path to wp-includes/functions.php has been redacted)

Expected behavior
If an image has the loading="lazy" attribute then it should not have fetchpriority="high" as well