[wp-trac] [WordPress Trac] #44632: Properly enqueue wp-embed
WordPress Trac
noreply at wordpress.org
Tue Nov 9 05:26:55 UTC 2021
#44632: Properly enqueue wp-embed
-------------------------------------+-------------------------------------
Reporter: alpipego | Owner: westonruter
Type: enhancement | Status: accepted
Priority: normal | Milestone: 5.9
Component: Embeds | Version: 4.4
Severity: normal | Resolution:
Keywords: has-patch has-unit- | Focuses: javascript,
tests | performance
-------------------------------------+-------------------------------------
Changes (by westonruter):
* version: => 4.4
Comment:
Ready for review: https://github.com/WordPress/wordpress-develop/pull/1745
See PR description for proposed changes:
> * Prevent loading `wp-embed` script unconditionally on every page in
favor of conditionally enqueueing when a post oEmbed is detected. The `wp-
embed` script is also explicitly marked as being in the footer group.
Sites which currently disable post embed scripts from being added via
`remove_action( 'wp_head', 'wp_oembed_add_host_js' );` will continue to do
so.
> * Send a `ready` message from the host page to each post embed window in
case the iframe loads before the `wp-embed.js` script. When the `ready`
message is received by the post embed window, it sends a the same `height`
message as it sends when it loads. This addresses #44306. To reproduce
this issue, see [https://core.trac.wordpress.org/attachment/ticket/44306
/slow-post-embeds.php example plugin].
> * Eliminate use of `grunt-include` to inject emoji script and the post
embed script. Instead obtain the script contents via `file_get_contents()`
(as is done elsewhere in core) and utilize
`wp_print_inline_script_tag()`/`wp_get_inline_script_tag()` to write out
the script. This simplifies the logic and allows the running of src
without `SCRIPT_DEBUG` enabled.
> * For the embed code that users are provided to copy (for embedding
outside of WP), add the missing inlined `wp-embed.js` script and the
`secret` on the `blockquote`/`iframe`. This ensures the `blockquote` will
be hidden when the `iframe` loads. The embed code in question is accessed
here (and via `get_post_embed_html()`
>
> ...
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44632#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list