X
Popular Searches

How to Get Rid of oEmbed rel=”alternate” Tags in WordPress

WordPress Logo Dark Mode
WordPress

WordPress is a great publishing platform with features for anybody and everybody. The problem with WordPress is that it’s full of features for anybody and everybody. So out of the box, it’s a little bloated until you chop it down to size.

For today’s adventure, I wanted to figure out how to delete all of the <link rel=”alternate” type=”application/json+oembed” /> nonsense that gets included — because there’s just no reason for it unless you’re worried about other WordPress sites using oEmbed to link to you. As long as you include Open Graph markup, your users can still share on Facebook, Twitter, etc, and your site will embed there just fine.

Luckily removing these from the template is easy, all you’re going to need to do is open up your theme’s functions.php file and paste in the following line:

remove_action('wp_head','wp_oembed_add_discovery_links', 10 );

Once you’ve done so, both of the <link rel=”alternate” lines will be gone. There will still be a lot of other unnecessary stuff, but I’ll save that for another day.

Lowell Heddings Lowell Heddings
Lowell is the founder and CEO of LifeSavvy Media. He’s been running the show since creating How-To Geek back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work. Read Full Bio »

The above article may contain affiliate links, which help support CloudSavvy IT.