mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-06 07:36:58 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@39104 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -30,7 +30,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
protected function prepare_items_query( $prepared_args = array(), $request = null ) {
|
||||
$query_args = parent::prepare_items_query( $prepared_args, $request );
|
||||
|
||||
if ( empty( $query_args['post_status'] ) || ! in_array( $query_args['post_status'], array( 'inherit', 'private', 'trash' ), true ) ) {
|
||||
if ( empty( $query_args['post_status'] ) ) {
|
||||
$query_args['post_status'] = 'inherit';
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
public function get_collection_params() {
|
||||
$params = parent::get_collection_params();
|
||||
$params['status']['default'] = 'inherit';
|
||||
$params['status']['enum'] = array( 'inherit', 'private', 'trash' );
|
||||
$params['status']['items']['enum'] = array( 'inherit', 'private', 'trash' );
|
||||
$media_types = $this->get_media_types();
|
||||
|
||||
$params['media_type'] = array(
|
||||
|
||||
Reference in New Issue
Block a user