Changeset 38947
- Timestamp:
- 10/26/2016 06:27:04 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/class-wp-rest-server.php
r38749 r38947 261 261 * 262 262 * @since 4.4.0 263 * @deprecated 4.7.0 Use the rest_authentication_errors filter to restrict access to the API 263 264 * 264 265 * @param bool $rest_enabled Whether the REST API is enabled. Default true. 265 266 */ 266 $enabled = apply_filters( 'rest_enabled', true);267 apply_filters_deprecated( 'rest_enabled', array( true ), '4.7.0', 'rest_authentication_errors', __( 'The REST API can no longer be completely disabled, the rest_authentication_errors can be used to restrict access to the API, instead.' ) ); 267 268 268 269 /** … … 277 278 $jsonp_callback = null; 278 279 279 if ( ! $enabled ) {280 echo $this->json_error( 'rest_disabled', __( 'The REST API is disabled on this site.' ), 404 );281 return false;282 }283 280 if ( isset( $_GET['_jsonp'] ) ) { 284 281 if ( ! $jsonp_enabled ) { -
trunk/tests/phpunit/tests/rest-api/rest-server.php
r37943 r38947 726 726 727 727 $this->assertEquals( 'noindex', $headers['X-Robots-Tag'] ); 728 } 729 730 /** 731 * @ticket 38446 732 * @expectedDeprecated rest_enabled 733 */ 734 public function test_rest_enable_filter_is_deprecated() { 735 add_filter( 'rest_enabled', '__return_false' ); 736 $this->server->serve_request( '/' ); 737 remove_filter( 'rest_enabled', '__return_false' ); 738 739 $result = json_decode( $this->server->sent_body ); 740 741 $this->assertObjectNotHasAttribute( 'code', $result ); 728 742 } 729 743
Note: See TracChangeset
for help on using the changeset viewer.