Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Conversation

@danielbachhuber
Copy link
Member

Attachments can only ever have the inherit, private, and trash statuses.

Fixes #1986

Attachments can only ever have the `inherit` status. As such, we should
force it upon the request and not expose `status` as a query param for
attachments.
@danielbachhuber danielbachhuber added this to the 2.0 Beta 11 milestone Jan 14, 2016
@danielbachhuber
Copy link
Member Author

@WP-API/amigos #reviewmerge

@rmccue
Copy link
Member

rmccue commented Jan 14, 2016

Attachments can only ever have the inherit status.

Is this necessarily true? Can plugins create attachments with a different status, or is it forced to inherit in WP?

@danielbachhuber
Copy link
Member Author

Is this necessarily true? Can plugins create attachments with a different status, or is it forced to inherit in WP?

Oh, huh. wp_insert_post() has:

if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash' ) ) ) {
    $post_status = 'inherit';
}

@danielbachhuber danielbachhuber changed the title Force GET /wp/v2/media to always use status=>inherit Force GET /wp/v2/media to be limited to 'status' => [ inherit, private, trash ] Jan 14, 2016
@danielbachhuber danielbachhuber self-assigned this Jan 14, 2016
@danielbachhuber
Copy link
Member Author

I'll update it to make sure we accommodate each of the statuses, and there's corresponding tests.

@danielbachhuber danielbachhuber removed their assignment Jan 14, 2016
@danielbachhuber
Copy link
Member Author

@WP-API/amigos #reviewmerge

joehoyle added a commit that referenced this pull request Jan 20, 2016
Force `GET /wp/v2/media` to be limited to 'status' => [ inherit, private, trash ]
@joehoyle joehoyle merged commit 2157c98 into develop Jan 20, 2016
@joehoyle joehoyle deleted the 1986-extend-prepare-items-query branch January 20, 2016 02:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants