Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How to Disable the WordPress JSON REST API Without Plugin

<?php
 add_filter( 'rest_authentication_errors', 'wp_snippet_disable_rest_api' );
   function wp_snippet_disable_rest_api( $access ) {
      return new WP_Error( 'rest_disabled', __('The WordPress REST API has been disabled.'), array( 'status' => rest_authorization_required_code()));
   }
?>
Source by wpdynamic.com #
 
PREVIOUS NEXT
Tagged: #How #Disable #WordPress #JSON #REST #API #Without #Plugin
ADD COMMENT
Topic
Name
9+5 =