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-comments-controller.php

    r39157 r39161  
    107107        if ( ! empty( $request['post'] ) ) {
    108108            foreach ( (array) $request['post'] as $post_id ) {
    109                 $post = $this->get_post( $post_id );
     109                $post = get_post( $post_id );
    110110
    111111                if ( ! empty( $post_id ) && $post && ! $this->check_read_post_permission( $post ) ) {
     
    315315        }
    316316
    317         $post = $this->get_post( $comment->comment_post_ID );
     317        $post = get_post( $comment->comment_post_ID );
    318318
    319319        if ( $post && ! $this->check_read_post_permission( $post ) ) {
     
    346346
    347347        if ( ! empty( $comment->comment_post_ID ) ) {
    348             $post = $this->get_post( $comment->comment_post_ID );
     348            $post = get_post( $comment->comment_post_ID );
    349349            if ( empty( $post ) ) {
    350350                return new WP_Error( 'rest_post_invalid_id', __( 'Invalid post id.' ), array( 'status' => 404 ) );
     
    390390        }
    391391
    392         if ( ! empty( $request['post'] ) && $post = $this->get_post( (int) $request['post'] ) ) {
     392        if ( ! empty( $request['post'] ) && $post = get_post( (int) $request['post'] ) ) {
    393393            if ( 'draft' === $post->post_status ) {
    394394                return new WP_Error( 'rest_comment_draft_post', __( 'Sorry, you cannot create a comment on this post.' ), array( 'status' => 403 ) );
     
    872872
    873873        if ( 0 !== (int) $comment->comment_post_ID ) {
    874             $post = $this->get_post( $comment->comment_post_ID );
     874            $post = get_post( $comment->comment_post_ID );
    875875
    876876            if ( ! empty( $post->ID ) ) {
Note: See TracChangeset for help on using the changeset viewer.