How to Use WP REST API and Disable JSON REST API in WordPress

By | February 22, 2016

The WP REST API is a WordPress plugin that intends to be eventually integrated into WordPress’ core as another big  step towards transforming WordPress from a blogging platform/CMS into a full fledged application framework. While WordPress is currently a great choice for a broad range of applications, one area where it currently falls short is providing an easy way for external programs to communicate with the WordPress website data. This is what the WP-API team aimed to fix.

With the WP API, you can perform any of the four CRUD actions against any of your WordPress site’s resources such as Posts, Pages, Media, Post meta, Post revisions, Comments, Taxonomies, Terms, Users. For example, you can use the WP API to create a post, retrieve a post, update a post or delete a post associated with your WordPress website.

How to Use WP REST API?

  • Download the WP REST API plugin.
  • Install and activate from dashboard.

WP REST API Activation

  • After activating plugin go to Settings => Permalinks. Change permalinks to something other than the default; we set ours to the Day and name option.

WP REST API - Permalinks

WP REST API Requests:

Here we will show you examples of some unauthenticated WP API GET requests. So, there’s no need to worry about any authentication plugins or settings.

Start by adding the Postman – REST Client shortcut.

Example: Getting list of Posts-

Here we will see how to get all of the posts that currently exist on your WordPress website. In order to do this, copy the following URL,

Replace ‘’ with the website that you installed the WP API plugin on (in our case it was the website; as you can see from the image below). Select GET from the drop down and click ‘Send’.


This is sending a GET request to your WordPress site’s server and the server is sending back a response based on the route and the HTTP action that is set. You should see a JSON response similar to the one below.


As you can see, this response is structured in a certain way so that you can easily and predictably access the data within it, this is called a schema. This structure is really important because knowing it, allows you to seek through the data programmatically.

How to Disable JSON REST API in WordPress?

WordPress 4.4 added the much anticipated JSON REST API. It is great for plugin developers. The API makes it very easy to retrieve data using GET requests. This is extremely useful for those building apps with WordPress, but many site owners may not find it useful at all. Here is how we can disable JSON REST API according to our need.

To disable JSON REST API simply add following code to your theme’s functions.php or in a site-specific plugin.

add_filter('json_enabled', '__return_false');
add_filter('json_jsonp_enabled', '__return_false');

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

There is another way of disabling JSON API if you do not want to add code manually. Simply install and activate Disable JSON API plugin.


Simply activating the plugin will disable the API on your site. You do not need to do any special settings for it.

Hope you found this article helpful in both using WP REST API plugin as well as disabling JSON APIs.

Related Post