Aug 2022 - WordPress 6.0.1
Others have given answers to OP's doubt.
I am just giving more insight into wp-embed
What does the wp-embed.min.js file do?
In short, It will make your link pretty
Add a block that displays content pulled from other sites, like Twitter or YouTube.
WordPress Block
Example
With wp-embed
Without wp-embed
If you turn off the wp-embed
in the functions, this is how it looks in the front end.
How can I get rid of it?
Something to know that this script sits in your footer
<script type='text/javascript' src='http://YOURSITE/wp-includes/js/wp-embed.min.js?ver=6.0.1' id='wp-embed-js'></script>
So you have two options. One is using wp_enqueue_scripts
and another is to use the wp_footer
.
Using wp_enqueue_scripts
function deregister_style_scripts() {
wp_deregister_script( 'wp-embed' );
}
add_action( 'wp_enqueue_scripts', 'deregister_style_scripts', 100 );
Using wp_footer
function deregister_style_scripts() {
wp_deregister_script( 'wp-embed' );
}
add_action( 'wp_footer', 'deregister_style_scripts' );
How to embed the link
Use the Embed
block
Embed doesn't work?
This usually happens when they do not want to embed their content within their site or outside. This can be controlled via X-Frame-Options
, there are two directives DENY
and SAMEORIGIN
Refused to connect
x-frame-options: DENY
Sorry, this content could not be embedded.
x-frame-options: SAMEORIGIN
Read more
About Embeds: https://wordpress.org/support/article/embeds/
x-Frame-Options: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options