Make WordPress Core


Ignore:
Timestamp:
02/19/2017 04:31:12 AM (8 years ago)
Author:
rachelbaker
Message:

REST API: Include the status property in view context responses from the Posts endpoints.

Previously the status for a Post (or other post_types) was only exposed under the edit context, which doesn't really make much sense considering we support querying by post status without authentication. Originally introduced in v2.0 beta 1: https://github.com/WP-API/WP-API/commit/69f617d749e4f165b9e31c1c042eec45ade3e41f without any explanation in the commit message.

Props dhanendran, jnylen0, rachelbaker.
Fixes #39466.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-rest-post-type-controller.php

    r39556 r40080  
    135135        }
    136136
     137        $this->assertEquals( $post->post_status, $data['status'] );
    137138        $this->assertEquals( $post->guid, $data['guid']['rendered'] );
    138139
    139140        if ( 'edit' === $context ) {
    140141            $this->assertEquals( $post->guid, $data['guid']['raw'] );
    141             $this->assertEquals( $post->post_status, $data['status'] );
    142142
    143143            if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) {
Note: See TracChangeset for help on using the changeset viewer.