WordPress.org

Make WordPress Core

Ticket #38446: 38446.diff

File 38446.diff, 1.1 KB (added by jorbin, 3 years ago)
  • src/wp-includes/rest-api/class-wp-rest-server.php

     
    260260                 * Filters whether the REST API is enabled.
    261261                 *
    262262                 * @since 4.4.0
     263                 * @deprecated deprecated since 4.7
    263264                 *
    264265                 * @param bool $rest_enabled Whether the REST API is enabled. Default true.
    265266                 */
    266                 $enabled = apply_filters( 'rest_enabled', true );
     267                $enabled = apply_filters_deprecated( 'rest_enabled', true, '4.7.0', false, __( 'The REST API can not be completely disabled as core functionality depends upon it' ) );
    267268
    268269                /**
    269270                 * Filters whether jsonp is enabled.
     
    276277
    277278                $jsonp_callback = null;
    278279
    279                 if ( ! $enabled ) {
    280                         echo $this->json_error( 'rest_disabled', __( 'The REST API is disabled on this site.' ), 404 );
    281                         return false;
    282                 }
    283280                if ( isset( $_GET['_jsonp'] ) ) {
    284281                        if ( ! $jsonp_enabled ) {
    285282                                echo $this->json_error( 'rest_callback_disabled', __( 'JSONP support is disabled on this site.' ), 400 );