WordPress Disable REST API Header Links

No Comments

Disable oEmbed Discovery Links:

WordPress 4.4 adds the following oEmbed discovery links to all single-view pages:

 

This markup can be disabled by adding the following line to functions.php:

remove_action(‘wp_head’, ‘wp_oembed_add_discovery_links’, 10);

Disable REST API link in HTTP headers:

WordPress 4.4 adds the following link header to all page requests:

Link: <http://example.com/path/wp-json/>; rel=”https://api.w.org/”

This header can be disabled by adding the following line to functions.php:

remove_action(‘template_redirect’, ‘rest_output_link_header’, 11, 0);

 

All Together

Putting these three techniques together, we get the following chunk of code:

// Disable REST API link tag

remove_action(‘wp_head’, ‘rest_output_link_wp_head’, 10);

// Disable oEmbed Discovery Links

remove_action(‘wp_head’, ‘wp_oembed_add_discovery_links’, 10);

// Disable REST API link in HTTP headers

remove_action(‘template_redirect’, ‘rest_output_link_header’, 11, 0);

This is author biographical info, that can be used to tell more about you, your iterests, background and experience. You can change it on Admin > Users > Your Profile > Biographical Info page."

About us and this blog

We are a digital marketing company with a focus on helping our customers achieve great results across several key areas.

Request a free quote

We offer professional SEO services that help websites increase their organic search score drastically in order to compete for the highest rankings even when it comes to highly competitive keywords.

Subscribe to our newsletter!

Fields marked with an * are required

signups

More from our blog

See all posts