WordPress: Enable REST API (rest_disabled: 401/403)

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.

  • 0 Utilizadores acharam útil
Esta resposta foi útil?

Artigos Relacionados

How to Change the Display Name of a WordPress User Account?

You can change the display name of your WordPress account which show on a WordPress post or...

How to add a new category in WordPress?

1. Login to your WordPress admin dashboard.2. Under the dashboard menu, hover your mouse on Posts...

How to remove the Uncategorized category from WordPress?

You can not remove "Uncategorized" Category but you can rename it1. Login to your WordPress admin...

How to remove a category in WordPress?

If you want to remove WordPress category then follow this instruction:1. Login to your WordPress...

How to Install a New Theme in WordPress?

You can install a new WordPress theme without having any technical knowledge. It"s so easy and...