Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #58894, comment 7


Ignore:
Timestamp:
09/11/2023 04:22:15 PM (3 months ago)
Author:
flixos90
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #58894, comment 7

    initial v1  
    1 @mukesh27 Currently, the logic in `wp_get_loading_optimization_attributes()` is heavily tied to specific context values. For example, if you want to display a custom image in the header to be enforced without `loading="lazy"`, you would need to pass the `get_header_image_tag` context, even if the image is not in fact the header image, so that is confusing and inflexible.
     1@mukesh27 Currently, the logic in `wp_get_loading_optimization_attributes()` is heavily tied to specific context values. For example, if you want to display a custom image in the header to be enforced without `loading="lazy"`, you would need to pass the `get_header_image_tag` context, even if the image is not in fact the header image. Or, if I display an image within the main query loop, it only works correctly if I use one of the predefined contexts like `the_post_thumbnail`, even if I'm not displaying a featured image. So the limitation of specific contexts is confusing and inflexible, and mostly, unnecessary.
    22
    33So technically speaking, this ticket is fundamentally about replacing the two big `switch` clauses with more generally applicable logic that is mostly decoupled from specific contexts.