To disable the REST API for JSON in WordPress, you can use a plugin or add code to your site's functions.php file. Here are the steps for each method:
Using a Plugin:
- Go to the "Plugins" section of your WordPress dashboard and click "Add New".
- Search for "Disable REST API" and choose a plugin to install.
- Install and activate the plugin.
- Once activated, the REST API will be disabled for all users.
Adding Code to functions.php:
- Go to "Appearance" -> "Theme Editor" in your WordPress dashboard.
- Open the "functions.php" file.
- Add the following code snippet at the end of the file:
pythonCopy code
add_filter('json_enabled', '__return_false');
add_filter('json_jsonp_enabled', '__return_false');
- Click "Update File" to save the changes.
- After making this change, the REST API will be disabled for all users.