Remove REST API Link Tag from WP Site Header

In one of my previous post, I discussed how to disable REST API in WP. Unfortunately, disabling the REST-API does not remove the API link tag on the the header section of your WP site. So, basically we are showing a link tag on our site’s header section that doesn’t have any function whatsoever.

Now, this is how the link tag shows up on WordPress based site’s header.

<link rel='' href='' />

In order to remove the tag simply place the following snippet on your current theme’s functions.php page and you are good to go.

<?php remove_action('wp_head','rest_output_link_wp_head', 10 ); ?>

What we are doing here is fairly simple. We are removing rest_output_link_header function from our site’s header. This function is responsible for generating the tag line which has been introduced since WordPress 4.4. Hope this post helps someone.

Today In History



Leave a Reply

Note: Convet HTML, PHP, JavaScripts from HTMLify, 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.