Wordpress Embeds (and how to disable)

Specific urls the wordpress auto-embeds

How to disable oEmbed

Plugin

The first way to disable embeds is to simply use a free plugin called Disable Embeds, developed by Pascal Birchler who is actually one of the core contributors to WordPress.

Disable Embeds in WordPress With Code

[code]
function disable_embeds_code_init() {

// Remove the REST API endpoint.
remove_action( ‘rest_api_init’, ‘wp_oembed_register_route’ );

// Turn off oEmbed auto discovery.
add_filter( ’embed_oembed_discover’, ‘__return_false’ );

// Don’t filter oEmbed results.
remove_filter( ‘oembed_dataparse’, ‘wp_filter_oembed_result’, 10 );

// Remove oEmbed discovery links.
remove_action( ‘wp_head’, ‘wp_oembed_add_discovery_links’ );

// Remove oEmbed-specific JavaScript from the front-end and back-end.
remove_action( ‘wp_head’, ‘wp_oembed_add_host_js’ );
add_filter( ‘tiny_mce_plugins’, ‘disable_embeds_tiny_mce_plugin’ );

// Remove all embeds rewrite rules.
add_filter( ‘rewrite_rules_array’, ‘disable_embeds_rewrites’ );

// Remove filter of the oEmbed result before any HTTP requests are made.
remove_filter( ‘pre_oembed_result’, ‘wp_filter_pre_oembed_result’, 10 );
}

add_action( ‘init’, ‘disable_embeds_code_init’, 9999 );

function disable_embeds_tiny_mce_plugin($plugins) {
return array_diff($plugins, array(‘wpembed’));
}

function disable_embeds_rewrites($rules) {
foreach($rules as $rule => $rewrite) {
if(false !== strpos($rewrite, ’embed=true’)) {
unset($rules[$rule]);
}
}
return $rules;
}
[/code]

OR

[code]

function my_deregister_scripts(){
wp_dequeue_script( ‘wp-embed’ );
}
add_action( ‘wp_footer’, ‘my_deregister_scripts’ );
[/code]

Inline Minified JS

A third option would be to grab the contents of the wp-embed.min.js file and embed it inline. This should only be done with small files or when there is not much code involved. This would be if you were simply wanting to get rid of the HTTP request but still leave support for embeds.

wp-embed-1
wp-embed-1


oEmbed #oEmbed
The easy embedding feature is mostly powered by oEmbed, a protocol for site A (such as your blog) to ask site B (such as YouTube) for the HTML needed to embed content from site B.

oEmbed was designed to avoid the need to copy and paste HTML from the site hosting the media you wish to embed. It supports videos, images, text, and more.

Service Embed Type Since
Amazon Kindle instant previews Videos WordPress 4.9
Animoto Videos WordPress 4.0
Blip Videos WordPress 2.9
Cloudup Videos, Galleries, Images WordPress 4.4
CollegeHumor Videos WordPress 4.0
Crowdsignal Polls & Surveys WordPress 3.0
DailyMotion Videos WordPress 2.9
Facebook post, activity, photo, video,
media, question, note
WordPress 4.7
Flickr Videos & Images WordPress 2.9
FunnyOrDie.com Videos WordPress 3.0
Giphy Animated GIFs WordPress 4.7
Hulu Videos WordPress 2.9
Imgur Images WordPress 3.9
Instagram Images WordPress 3.5
Issuu Documents WordPress 4.0
Kickstarter Projects WordPress 4.2
Meetup.com Various WordPress 3.9
Mixcloud Music WordPress 4.0
Photobucket Images WordPress 2.9
Reddit Posts & Comments WordPress 4.4
ReverbNation Music WordPress 4.4
Scribd Documents WordPress 2.9
SlideShare Presentation slideshows WordPress 3.5
SmugMug Various WordPress 3.0
SoundCloud Music WordPress 3.5
Speaker Deck Presentation slideshows WordPress 4.4
Spotify Music WordPress 3.6
TED Videos WordPress 4.0
Tumblr Various WordPress 4.2
Twitter Tweet, profile, list,
collection, likes, Moment
WordPress 3.4
VideoPress Videos WordPress 4.4
Vimeo Videos WordPress 2.9
Vine Videos WordPress 4.1
WordPress plugin directory Plugins WordPress 4.4
WordPress.tv Videos WordPress 2.9
YouTube Videos WordPress 2.9

Scroll to Top