WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/26/2016 06:27:04 AM (3 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-server.php

    r37943 r38947  
    726726
    727727        $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 );
    728742    }
    729743
Note: See TracChangeset for help on using the changeset viewer.