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

WordPress Trac noreply at wordpress.org
Tue Oct 17 22:51:48 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 adamsilverstein):

 > Hmm, the render_block filter should be fired before the relevant logic.
 Yes, I'm pretty sure core "saw" the attribute because before applied it
 manually, core added `fetchpriority="high"` to the first image. When I
 manually added `fetchpriority="high"` to the first image, core added it to
 the second image.

 > When you encounter the bug, is the image that WordPress adds
 fetchpriority="high" to before the image that your plugin adds
 fetchpriority="high" too? If so, that would explain the problem.

 In my test, I'm pretty sure I set `fetchpriority="high"` on the first
 large image and core still added it to the second image.

 Regardless - I feel we should probably avoid adding `fetchpriority="high"`
 to any image if the content already contains an image with
 `fetchpriority="high"`. What do you think? We could avoid this with a
 content check early, before adding it.

 Here is a test post where you can see the behavior: https://wp-sample-
 pages.instawp.xyz/with-manually-set-high-and-low/

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


More information about the wp-trac mailing list