Remove oEmbed Discovery Link Tag

  • iftekhar
  • Oct 5, 2015
  • 2 comments
  • 4295 Views
  • Print

By default WP supports oEmbed which allows users to add media content (videos, music, images etc.) within their post very easily. WP has pretty good documentation of this service which could be particularly useful for certain users.

However, I personally do not want to use this service as I barely add contents from third party web sites. oEmbed adds two different tag line on your site’s header section. Removing them seems to disabled this service automatically. These tags looks something like this.

<link rel="alternate" type="application/json oembed" href="" />
<link rel="alternate" type="text/xml oembed" href="" />

Now, in order to remove them, you just simply need to copy and paste the following snippet on your current theme’s functions.php page and you are good to go.

<?php
// removes oembed discorvery link
remove_action('wp_head','wp_oembed_add_discovery_links', 10 );
remove_action('wp_head','wp_oembed_add_host_js');
?>

Do not forget to update your functions.php page. Go to the front-end of your site and refresh your page. You shouldn’t be seeing the tags on your site’s header section anymore. Hope that helps.

  •  
  •  

Comment

2 Comments

  1. AntonPublished: 2 years ago

    Thanks a lot.

    • iftekharPublished: 2 months ago

      You are welcome.

Leave a Reply to iftekhar

Note: Convet HTML, PHP, JavaScripts from Postable, before posting from comment section.
License: By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution. Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.