[wp-trac] [WordPress Trac] #58893: Introduce filter to modify/override attributes returned by `wp_get_loading_optimization_attributes()`

WordPress Trac noreply at wordpress.org
Tue Sep 3 17:05:48 UTC 2024


#58893: Introduce filter to modify/override attributes returned by
`wp_get_loading_optimization_attributes()`
-------------------------------------------------+-------------------------
 Reporter:  flixos90                             |       Owner:  pereirinha
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.4
Component:  Media                                |     Version:  6.3
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch, changes-requested, has-   |     Focuses:
  dev-note                                       |  performance
-------------------------------------------------+-------------------------

Comment (by flixos90):

 In [changeset:"58974" 58974]:
 {{{
 #!CommitTicketReference repository="" revision="58974"
 Media: Consistently pass 'src' attribute to
 `wp_get_loading_optimization_attributes()`.

 A common use-case for the 'wp_get_loading_optimization_attributes' filter
 is to modify attributes based on the 'src' attribute. However, the
 `wp_img_tag_add_loading_optimization_attrs()` was not passing that
 attribute to the function as expected, which would make such usage of the
 filter unreliable. This changeset ensures the 'src' attribute is also
 passed in this scenario. All other calls to
 `wp_get_loading_optimization_attributes()` already included the attribute.

 Props deepakrohilla, prestonwordsworth, mukesh27, adamsilverstein,
 joemcgill, flixos90.
 Fixes #61436.
 See #58893.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58893#comment:29>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list