[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 17:50:11 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):

 Replying to [comment:3 adamsilverstein]:
 > It is saved as a block attribute, then applied to the markup dynamically
 using the `render_block` filter - see https://github.com/adamsilverstein
 /wp-fetchpriority-control/blob/dd0281b319794d7fe44317cb588a6c135f970200
 /wp-fetchpriority-control.php#L34-L54
 >
 > Do you think the timing of this filtering is part of the issue?

 Hmm, the `render_block` filter should be fired before the relevant logic.
 I wonder whether the issue is more about the image ordering. Here's why:
 WordPress core only goes through all the images sequentially. So by the
 time it encounters the image that your plugin has added
 `fetchpriority="high"` to, it may have already added the attribute to one
 of the images before.

 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.

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


More information about the wp-trac mailing list