[wp-trac] [WordPress Trac] #44632: Properly enqueue wp-embed

WordPress Trac noreply at wordpress.org
Mon Oct 11 00:39:55 UTC 2021


#44632: Properly enqueue wp-embed
-------------------------+------------------------------
 Reporter:  alpipego     |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Embeds       |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------------------

Comment (by westonruter):

 Related to this is #44306 in which someone reports the messages from the
 iframes are being sent too early when the script is being printed in the
 footer. But the footer is where this should be printed regardless (or at
 least not in the `head`).

 Nevertheless, I also just noticed that the `wp-embed` script is printed on
 ''every'' page unconditionally. Isn't this incorrect and a negative impact
 on page performance? Shouldn't it only ever be printed if there is an
 oEmbed on the page which actually outputs an `iframe` with the `wp-
 embedded-content` class?

 Secondly, this `script` seems it would benefit from the `defer` attribute
 being added to it. But the race condition described in #44306 should be
 figured out. This may entail inlining the `script` before the first
 `iframe.wp-embedded-content` instead. So what about doing just that? What
 about filtering `embed_oembed_html` to prepend an inlined `wp-embed`
 script before post embeds? See [attachment:44632.2.diff].

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


More information about the wp-trac mailing list