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:

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...
In WordPress, when you delete a post or comment, they are placed in the trash. By default, records and comments in the cart remain in your database for 30 days, giving you enough time to restore them if necessary. After 30 days, WordPress automatically deletes...
Do you want to add notifications to the admin panel in WordPress? Admin notifications are used by the WordPress core, themes, and plugins to display warnings, notifications, and important information for users on the screen. In this article, we will show you h...