The WordPress REST API has become a part of the WordPress core starting from the version 4.7.
It is, for example, required by the WordPress Block Editor, and if the WordPress REST API is disabled, you won’t be able to publish or update your posts: “Updating failed. REST API disabled.“.
Normally, the WordPress REST API should be enabled by default and doesn’t require installation of any additional plugins for this.
If the WordPress REST API on your website is still disabled this may be caused by the “W3 Total Cache” plugin (if it is installed and active).
This note shows how to enable the WordPress REST API if it has been disabled by the “W3 Total Cache”.
Enable WordPress REST API
To check the status of the WordPress REST API, you can log in to your “Dashboard”, in the left sidebar hover over the “Tools” and click on the “Site Health”.
If the WordPress REST API is disable you will see the message as follows:
The REST API encountered an unexpected result Performance
The REST API call gave the following unexpected result: (403) {“code”:”rest_disabled”,”message”:”REST API disabled.”,”data”:{“status”:403}}.
Also you can check if the WordPress REST API is disabled by opening the URL as follows in a web browser: https://<your-website>/wp-json/
.
The response as follows confirms that the WordPress REST API is disabled:
{"code":"rest_disabled","message":"REST API disabled.","data":{"status":401}}
If the WordPress REST API has been disabled by the “W3 Total Cache” plugin, log in to your “Dashboard”, in the left sidebar hover over the “Performance”, click on the “Page Cache”, search for the “REST API” block and disable the cache:
The WordPress REST API should become enabled as only you disable the caching of the “REST API” in the “W3 Total Cache” settings.