Remove api.w.org REST API/JSON API from WordPress header.

Harish Kumar · · 6143 Views

WordPress uses the REST API since edition 4.4 of the CMS. It allows developers to interact with the WordPress back-end more quickly since this API is a standard way to connect. However, this also adds the following header to your Worpress website:

<head>
...
<link rel='https://api.w.org/' href='http://example.com/wp-json/' />
<link rel="alternate" type="application/json+oembed" href="http://example.com/wp-json/oembed/1.0/embed?url=..." />
<link rel="alternate" type="text/xml+oembed" href="http://example.com/wp-json/oembed/1.0/embed?url=..." />
</head>

To remove this added header from the WordPress website, you need to add the following lines of code in the functions.php file within the WordPress theme’s directory.

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

To remove the rest_output_link_header

remove_action( 'template_redirect', 'rest_output_link_header', 11, 0 );

Reference

  1. wp_oembed_add_discovery_links

  2. rest_output_link_wp_head

  3. rest_output_link_header

0

Please login or create new account to add your comment.

0 comments
You may also like:

Top Podcast Recording Software

This blog lets you explore the top 10 podcast recording software options that prioritize ease of use, clear recording quality, and features specifically helpful for businesses. (...)
Narola Infotech

Data Integration Tools

An ocean of data integration tools that promise to be “the best” makes it easy to get confused. Based on research, usage experience, and popular ratings, we have compiled a (...)
Narola Infotech

How to Build Flutter App for any WordPress Site

Leaving a perfect digital footprint is crucial for brand growth. However, you may be here to find the optimal balance between mobile engagement and web traffic. It’s possible (...)
Narola Infotech

The Benefits of Using Hospital Management Software in 2024: A Guide for Healthcare Providers

In the ever-evolving healthcare landscape, integrating technology has become imperative for efficient and effective patient care. One such technological advancement that has revolutionized (...)
anika

Types of Web Applications With Examples And Industry Use Cases

Whether it’s about driving more revenue for your business or strengthening your branding game, an impactful online presence is crucial. To make sure this is done right, there (...)
Narola Infotech

Use Transients API Caching and Speed Up Your WordPress Theme.

The Transients API in WordPress is an effective method for saving cached data in the database. It allows us to take resource-intensive queries and store them in short-term caches (...)
Harish Kumar