Make WordPress Core


Ignore:
Timestamp:
11/08/2016 01:08:49 PM (8 years ago)
Author:
joehoyle
Message:

REST API: Remove rest_get_post filter and get_post abstraction.

This filter was originally introduced in https://github.com/WP-API/WP-API/pull/2535 to support Customizer Changesets (née Transactions). This is a super broad filter and doesn't really fit with the design of the API, nor is it (arguably) the right level to do this.

Props rmccue.
Fixes #38701.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php

    r39126 r39161  
    118118    public function get_items_permissions_check( $request ) {
    119119
    120         $parent = $this->get_post( $request['parent'] );
     120        $parent = get_post( $request['parent'] );
    121121        if ( ! $parent ) {
    122122            return true;
     
    140140     */
    141141    public function get_items( $request ) {
    142 
    143         $parent = $this->get_post( $request['parent'] );
     142        $parent = get_post( $request['parent'] );
    144143        if ( ! $request['parent'] || ! $parent || $this->parent_post_type !== $parent->post_type ) {
    145144            return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent id.' ), array( 'status' => 404 ) );
     
    179178     */
    180179    public function get_item( $request ) {
    181 
    182         $parent = $this->get_post( $request['parent'] );
     180        $parent = get_post( $request['parent'] );
    183181        if ( ! $request['parent'] || ! $parent || $this->parent_post_type !== $parent->post_type ) {
    184182            return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent id.' ), array( 'status' => 404 ) );
    185183        }
    186184
    187         $revision = $this->get_post( $request['id'] );
     185        $revision = get_post( $request['id'] );
    188186        if ( ! $revision || 'revision' !== $revision->post_type ) {
    189187            return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision id.' ), array( 'status' => 404 ) );
     
    210208        }
    211209
    212         $post = $this->get_post( $request['id'] );
     210        $post = get_post( $request['id'] );
    213211        if ( ! $post ) {
    214212            return new WP_Error( 'rest_post_invalid_id', __( 'Invalid revision id.' ), array( 'status' => 404 ) );
     
    235233        }
    236234
    237         $revision = $this->get_post( $request['id'] );
     235        $revision = get_post( $request['id'] );
    238236        $previous = $this->prepare_item_for_response( $revision, $request );
    239237
Note: See TracChangeset for help on using the changeset viewer.