How to Easily Disable the REST API for JSON in WordPress Print

  • WordPress, REST API, Disable., JSON
  • 0

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:

  1. Go to the "Plugins" section of your WordPress dashboard and click "Add New".
  2. Search for "Disable REST API" and choose a plugin to install.
  3. Install and activate the plugin.
  4. Once activated, the REST API will be disabled for all users.

Adding Code to functions.php:

  1. Go to "Appearance" -> "Theme Editor" in your WordPress dashboard.
  2. Open the "functions.php" file.
  3. 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');
  1. Click "Update File" to save the changes.
  2. After making this change, the REST API will be disabled for all users.

Was this answer helpful?

« Back

Powered by WHMCompleteSolution