How To Disable The JSON REST API In WordPress

a minute read

In WordPress 4.4, the long awaited JSON REST API has been added. This is a great plugin for developers, but for many site owners it is simply useless. In this article, we will show you how to easily disable the JSON REST API in WordPress.

Why Do I Need To Disable The JSON REST API In WordPress?

There is no doubt that the API will bring many new features for WordPress developers. However, some site owners simply do not need such features. The API makes it very easy to get data using GET requests. This is very useful for developing applications with WordPress.

And all this potentially opens your site to a new front of DDoS attacks, which can take a lot of resources and, as a result, slow down your site.

This method is similar to turning off XML-RPC, as many administrators have already done on their WordPress sites just in case.

Disable JSON REST API In WordPress

If you want to disable the JSON REST API on your WordPress site, you can do it by simply adding the following code to the functions.php file of your theme or to the plugin for the WordPress site :

1 add_filter('json_enabled''__return_false');
2 add_filter('json_jsonp_enabled''__return_false');

The code uses built-in filters to disable JSON and JSONP API.

For those who do not want to manually add code, you can install and activate the Disable JSON API plugin . The plugin works out of the box, and does not contain additional options for its configuration. Simple activation plugin will disable the API on your site.

We hope this article has helped you learn how to disable Disable JSON API in WordPress


Facebook Twitter LinkedIn Telegram Pocket

Related Posts:

To retrieve user data using the TikTok API, you can follow these steps:Obtain an API key: Firstly, you need to register as a TikTok developer and apply for an API key. The API key is required to authenticate your API requests. Authenticate requests: Use your A...
To disable WordPress plugins, you can follow these steps:Log in to your WordPress admin panel.From the admin dashboard, go to the "Plugins" tab.On the "Plugins" page, you'll find a list of all installed plugins.Locate the plugin you want to...
Would you like to turn off email notification about automatic WordPress update? By default, WordPress sends email notifications to inform you that security updates have been installed on your site. Recently, a reader asked if there was a way to disable these e...