Use code PERFMATTERS for an additional 10% off!

How to Remove WordPress REST API Links

The WordPress REST API enables the CMS to communicate with other web properties, no matter what programming language they’re written in. According to the WordPress handbook:

The WordPress REST API provides API endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON (JavaScript Object Notation) objects.

However, a lot of sites don’t use this, and therefore in most cases, it is just unnecessary code. By default, every site includes a link in the header:

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

There is also a header that is sent on each request:

function rest_output_link_header() {
 if ( headers_sent() ) {
 $api_root = get_rest_url();
 if ( empty( $api_root ) ) {

You can easily remove WordPress REST API links by enabling the “Remove REST API Links” option.

Remove WordPress REST API links in header
Remove WordPress REST API links in header

Was this article helpful?

Related Articles