About wp-embed.js in WordPress 4.4 and How to Disable it?

Updated on September 1, 2017

I recently updated WordPress to version 4.4 and found a new JavaScript loaded in the footer. It’s none other than wp-embed.js file. After googling, I understood that WordPress 4.4 comes with a feature (oEmbed consumer) that allows users to embed content from other sites – such as YouTube videos, tweets and posts from WordPress sites. For example if you like to embed a YouTube video in your post, you just need to place its URL in the content area and WordPress does the rest. If you like to read more about the feature, then click here.

It’s a useful feature, but I did not want one more JavaScript being loaded and if you are like me who wish to have fewer HTTP requests, then you can stop loading wp-embed.js using the below snippet.

wordpress embed script

How to disable or remove wp-embed.js from WordPress?

All you need to do is to copy and paste the below snippet in functions.php file located in your theme directory.

function my_deregister_scripts(){
 wp_deregister_script( 'wp-embed' );
}
add_action( 'wp_footer', 'my_deregister_scripts' );

Note: If you don’t want to mess with your theme code, then you may use a plugin to Disable Embeds (I haven’t tested this plugin).

Was this article helpful?

Related Articles

Comments Leave a Comment

Leave a Comment