Home » WordPress » How to Disable WP REST API

How to Disable WP REST API

WordPress Rest API helps to GET the JSON objects from the WP endpoint. By using WP Rest API, you can GET all the data from the website and use it on any platform which you like. WP Rest API allows developers to use in the Mobile Application, Angular, or any other applications. ( E.g. Here we used WordPress posts in Angular App to display all the posts by using WP Rest API. )

The WordPress Rest API endpoints work with the below example URL.

Disabling the WordPress Rest API

The benefits of disabling the WordPress Rest API gives protection from hackers and unauthorized users. The WP Rest API is default given by the WordPress, we need to disable or access to allow with the username and password.

The below code will help you disable Rest API from unauthorized user access.

Below you can see after disabling the WP Rest API output.

Disabling the WordPress Rest API

An alternative to Disable the WP Rest API with WordPress Plugin

Using the plugin is the simplest way to disable the WP Rest API but this will make some more weight to your website also plugins are third-party.

Use the Disable REST API to disable.

In Admin Dashboard Settings -> Disable Rest API

An alternative to Disable the WP Rest API with WordPress Plugin

In the above screen, you can see they are many ways to disabling the JSON data. Benefits of using plugin easy handling with Frontend UI and get various options.

Conclusion:

I hope this will help you to disable the WP Rest API either with custom code without plugin or by using a plugin. If you have any questions about this topic let me know in the comment section. If you like this article share it with your friends.

Was this article helpful?

Yes No
×

How can we improve it?

×

We appreciate your helpul feedback!

Your answer will be used to improve our content. The more feedback you give us, the better our pages can be.

Follow us on social media:

Facebook Pinterest

Mraj

Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top