[wp-trac] [WordPress Trac] #59641: manually setting fetchpriority on image should prevent core from adding fetchpriority attribute

WordPress Trac noreply at wordpress.org
Wed Oct 18 19:01:59 UTC 2023


#59641: manually setting fetchpriority on image should prevent core from adding
fetchpriority attribute
-----------------------------+--------------------------
 Reporter:  adamsilverstein  |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  6.5
Component:  Media            |     Version:  6.3
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:  performance
-----------------------------+--------------------------

Comment (by flixos90):

 @adamsilverstein We can see if we can find a solution to that problem, but
 at the moment, due to the sequential processing of images, we can't update
 an image that was already given `fetchpriority="high"` when ''later''
 another image already had the attribute present from a plugin. We would
 need to somehow parse the entire content in advance, which I'm not sure is
 feasible unless we apply output buffering - especially since the problem
 could go beyond images in the post content, these images could appear
 anywhere.

 Based on where we are now, I'm curious whether you could apply the new 6.4
 filters in your plugin to ensure the `fetchpriority="high"` attribute is
 only on the one image that it was added to. See
 https://make.wordpress.org/core/2023/10/18/image-loading-optimization-
 enhancements-
 in-6-4/#:~:text=You%20could%20use%20the%20wp_get_loading_optimization_attributes%20filter%20to%20ensure%20a%20specific%20image%20within%20post%20content%20receives%20the%20fetchpriority%3D%22high%22%20attribute%20while%20other%20ones%20do%20not%3A
 for a related reference example.

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


More information about the wp-trac mailing list