REST API: Deprecate the `rest_enabled` filter.
As the REST API becomes more integral to WordPress Core, turning it off will cause a... suboptimal experience. If we don't want it to be turned off, the off switch needs to be removed. Props jorbin, pento. Fixes #38446. Built from https://develop.svn.wordpress.org/trunk@38947 git-svn-id: http://core.svn.wordpress.org/trunk@38890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
11e7d3d250
commit
6b4357e14b
|
@ -260,10 +260,11 @@ class WP_REST_Server {
|
||||||
* Filters whether the REST API is enabled.
|
* Filters whether the REST API is enabled.
|
||||||
*
|
*
|
||||||
* @since 4.4.0
|
* @since 4.4.0
|
||||||
|
* @deprecated 4.7.0 Use the rest_authentication_errors filter to restrict access to the API
|
||||||
*
|
*
|
||||||
* @param bool $rest_enabled Whether the REST API is enabled. Default true.
|
* @param bool $rest_enabled Whether the REST API is enabled. Default true.
|
||||||
*/
|
*/
|
||||||
$enabled = apply_filters( 'rest_enabled', true );
|
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.' ) );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters whether jsonp is enabled.
|
* Filters whether jsonp is enabled.
|
||||||
|
@ -276,10 +277,6 @@ class WP_REST_Server {
|
||||||
|
|
||||||
$jsonp_callback = null;
|
$jsonp_callback = null;
|
||||||
|
|
||||||
if ( ! $enabled ) {
|
|
||||||
echo $this->json_error( 'rest_disabled', __( 'The REST API is disabled on this site.' ), 404 );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ( isset( $_GET['_jsonp'] ) ) {
|
if ( isset( $_GET['_jsonp'] ) ) {
|
||||||
if ( ! $jsonp_enabled ) {
|
if ( ! $jsonp_enabled ) {
|
||||||
echo $this->json_error( 'rest_callback_disabled', __( 'JSONP support is disabled on this site.' ), 400 );
|
echo $this->json_error( 'rest_callback_disabled', __( 'JSONP support is disabled on this site.' ), 400 );
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-alpha-38946';
|
$wp_version = '4.7-alpha-38947';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue