Disable REST API - Version 1.2

Version Description

  • Tested for WP v4.5
  • Removal of actions which publish REST info to the head and header
Download this release

Release Info

Developer dmchale
Plugin Icon 128x128 Disable REST API
Version 1.2
Comparing to
See all releases

Code changes from version 1.1 to 1.2

Files changed (2) hide show
  1. disable-json-api.php +7 -2
  2. readme.txt +16 -7
disable-json-api.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Disable JSON API
4
  * Plugin URI: http://www.binarytemplar.com/disable-json-api
5
  * Description: Uses the built-in filters of the JSON REST API to disable its functionality
6
- * Version: 1.1
7
  * Author: Dave McHale
8
  * Author URI: http://www.binarytemplar.com
9
  * License: GPL2+
@@ -15,4 +15,9 @@ add_filter('json_jsonp_enabled', '__return_false');
15
 
16
  // Filters for WP-API version 2.x
17
  add_filter('rest_enabled', '__return_false');
18
- add_filter('rest_jsonp_enabled', '__return_false');
 
 
 
 
 
3
  * Plugin Name: Disable JSON API
4
  * Plugin URI: http://www.binarytemplar.com/disable-json-api
5
  * Description: Uses the built-in filters of the JSON REST API to disable its functionality
6
+ * Version: 1.2
7
  * Author: Dave McHale
8
  * Author URI: http://www.binarytemplar.com
9
  * License: GPL2+
15
 
16
  // Filters for WP-API version 2.x
17
  add_filter('rest_enabled', '__return_false');
18
+ add_filter('rest_jsonp_enabled', '__return_false');
19
+
20
+ // Remove REST API info from head and headers
21
+ remove_action( 'xmlrpc_rsd_apis', 'rest_output_rsd' );
22
+ remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
23
+ remove_action( 'template_redirect', 'rest_output_link_header', 11 );
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: dmchale
3
  Tags: admin, api, json, REST, rest-api, disable
4
  Requires at least: 4.0
5
- Tested up to: 4.2.1
6
- Stable tag: 1.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -11,16 +11,17 @@ Uses the built-in filters of the JSON REST API to disable its functionality.
11
 
12
  == Description ==
13
 
14
- ** Now supporting the 2.0 beta API **
15
 
16
  The JSON REST API is currently in development via the [JSON REST API](https://wordpress.org/plugins/json-rest-api/)
17
- plugin by Ryan McCue. Soon, this functionality will become a part of WordPress Core. While this is very exciting news
 
18
  for many reasons, it is also not functionality that every site admin is going to want enabled on their website.
19
  Similar to other plugins which already disable the XML-RPC protocol, this plugin looks to make your life simple by
20
  allowing you to disable the JSON REST API simply by installing and activating this plugin.
21
 
22
- If you are such an admin, you can install this plugin now to ensure that your site will not support the JSON REST API
23
- when it is launched as a part of WordPress Core.
24
 
25
  This plugin simply uses two filters that are built into the API which turn off support for JSON and JSONP,
26
  respectively. Nothing is done which is not intended by the API author(s).
@@ -34,7 +35,11 @@ area
34
 
35
  == Frequently Asked Questions ==
36
 
37
- n/a
 
 
 
 
38
 
39
  == Screenshots ==
40
 
@@ -42,6 +47,10 @@ n/a
42
 
43
  == Changelog ==
44
 
 
 
 
 
45
  = 1.1 =
46
  * Updated to support the new filters created in the 2.0 beta API
47
 
2
  Contributors: dmchale
3
  Tags: admin, api, json, REST, rest-api, disable
4
  Requires at least: 4.0
5
+ Tested up to: 4.5
6
+ Stable tag: 1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
11
 
12
  == Description ==
13
 
14
+ ** Now supporting the 1.x API, the 2.x beta API, and the API features found in WP Core since v4.4 **
15
 
16
  The JSON REST API is currently in development via the [JSON REST API](https://wordpress.org/plugins/json-rest-api/)
17
+ plugin by Ryan McCue. The engine for the API exists in WordPress as of v4.4, but additional functionality and working
18
+ endpoints are still in development. While this is very exciting news
19
  for many reasons, it is also not functionality that every site admin is going to want enabled on their website.
20
  Similar to other plugins which already disable the XML-RPC protocol, this plugin looks to make your life simple by
21
  allowing you to disable the JSON REST API simply by installing and activating this plugin.
22
 
23
+ You can install this plugin now to ensure that your site will not support the JSON REST API as it exists in its
24
+ current state.
25
 
26
  This plugin simply uses two filters that are built into the API which turn off support for JSON and JSONP,
27
  respectively. Nothing is done which is not intended by the API author(s).
35
 
36
  == Frequently Asked Questions ==
37
 
38
+ = Is this plugin compatible with __insert other REST API plugin here__? =
39
+
40
+ This plugin ONLY uses the filters built into the official WordPress REST API meant for disabling its functionality.
41
+ So long as your other REST API does not also use those filters to allow itself to be disabled (and it shouldn't), you
42
+ should be safe.
43
 
44
  == Screenshots ==
45
 
47
 
48
  == Changelog ==
49
 
50
+ = 1.2 =
51
+ * Tested for WP v4.5
52
+ * Removal of actions which publish REST info to the head and header
53
+
54
  = 1.1 =
55
  * Updated to support the new filters created in the 2.0 beta API
56