This repository was archived by the owner on Sep 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 651
This repository was archived by the owner on Sep 24, 2018. It is now read-only.
Abstract Attachment-specific conditionals to Attachments controller #1986
Copy link
Copy link
Closed
Description
There are a few instances of Attachment-specific conditionals in the Posts controller that would be better off in the Attachments controller:
-
WP-API/lib/endpoints/class-wp-rest-posts-controller.php
Lines 537 to 539 in a93ea66
if ( empty( $query_args['post_status'] ) && 'attachment' === $this->post_type ) { $query_args['post_status'] = 'inherit'; } -
WP-API/lib/endpoints/class-wp-rest-posts-controller.php
Lines 962 to 972 in a93ea66
// Can we read the parent if we're inheriting? if ( 'inherit' === $post->post_status && $post->post_parent > 0 ) { $parent = get_post( $post->post_parent ); return $this->check_read_permission( $parent ); } // If we don't have a parent, but the status is set to inherit, assume // it's published (as per get_post_status()). if ( 'inherit' === $post->post_status ) { return true; } -
'default' => 'attachment' === $this->post_type ? 'inherit' : 'publish', -
if ( 'publish' === $value || ( 'attachment' === $this->post_type && 'inherit' === $value ) ) {