Disable JSON REST API

Having API available on your website brings a lot of benefits to WordPress developers. However, some website owners, like yourself or others may not be able to use those features to its full potential. The API makes it extremely easy to retrieve data. This makes it useful for people building apps with WordPress.

The downside of having is potentially opens your website to a new front of DDoS attacks. It can also slow down your website, so if you do not use it, disable it.

Disabling JSON REST API in WordPress

If you want to disable JSON REST API on your WordPress site, then you can easily do so by simply adding the following code in your theme’s functions.php

add_filter('json_enabled', '__return_false');

add_filter('json_jsonp_enabled', '__return_false')[{/php]

This code simply uses the built-in filters to disable the JSON and JSONP APIs.

Do you not want to add the code? You can just install this plugin, the reason we offer the code to you is because adding another plugin just makes the site heavier, but if you are not confident in adding the code, install the plugin below – there is no settings for the plugin, just install and you are done.