Make WordPress Core


Ignore:
Timestamp:
11/03/2016 01:45:48 AM (7 years ago)
Author:
joehoyle
Message:

REST API: Support querying for multiple post statuses.

Multiple post statuses can be specified by the usual CSV or array-propper format.

Props jnylen0, kadamwhite, websupporter.
Fixes #38420.

File:
1 edited

Legend:

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

    r39047 r39104  
    3131        $query_args = parent::prepare_items_query( $prepared_args, $request );
    3232
    33         if ( empty( $query_args['post_status'] ) || ! in_array( $query_args['post_status'], array( 'inherit', 'private', 'trash' ), true ) ) {
     33        if ( empty( $query_args['post_status'] ) ) {
    3434            $query_args['post_status'] = 'inherit';
    3535        }
     
    587587        $params = parent::get_collection_params();
    588588        $params['status']['default'] = 'inherit';
    589         $params['status']['enum'] = array( 'inherit', 'private', 'trash' );
     589        $params['status']['items']['enum'] = array( 'inherit', 'private', 'trash' );
    590590        $media_types = $this->get_media_types();
    591591
Note: See TracChangeset for help on using the changeset viewer.