Essential Classy Addons For Elementor

Limited Time Offer, Flat 40% off on xmas23 Code.
WordPress site now to load the wp-embed.min.js file. And this loads on every single page.
The request itself is sometimes a bigger deal than the content download size.

There are two ways.

1. Custom code in function.php

add_action('init', 'ec_disable_embeds', 9999);
function ec_disable_embeds(){
	global $wp;
	$wp->public_query_vars = array_diff($wp->public_query_vars, array('embed'));
	add_filter('embed_oembed_discover', '__return_false');
	remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10);
	remove_action('wp_head', 'wp_oembed_add_discovery_links');
	remove_action('wp_head', 'wp_oembed_add_host_js');
	add_filter('tiny_mce_plugins', function( $plugins ) {
		return array_diff($plugins, array('wpembed'));
	});
	add_filter('rewrite_rules_array', function($rules) {
		foreach($rules as $rule => $rewrite) {
			if(false !== strpos($rewrite, 'embed=true')) {
				unset($rules[$rule]);
			}
		}
		return $rules;
	});
	remove_filter('pre_oembed_result', 'wp_filter_pre_oembed_result', 10);
}

2. Using EC Addons