Discover in this tutorial how to disable the WordPress REST API with a simple code snippet.
The WordPress REST API is a fantastic tool that allows you to access a lot of data from an installation
This offers (almost) endless options, from getting the number of posts to creating headless WordPress, where the CSM is only used as a backend and the content is displayed in an app or similar.
But if you are not making use of it and prefer to keep it disabled until you need it, you can achieve this easily.
Snippet to disable the WordPress REST API
Add the following code at the end of functions.php or in your functionality plugin:
To see this and another 965 code snippets of this website, login or subscribe here.
Can you see how easy it is?
Conclusion
Now you know how to disable the WordPress REST API using code.
And if you need to use it later, just delete the snippet and that’s it.
Any questions? I read you in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉