[wp-trac] [WordPress Trac] #47782: REST API Media returning blank

WordPress Trac noreply at wordpress.org
Fri Jul 26 16:47:49 UTC 2019


#47782: REST API Media returning blank
--------------------------+------------------------------
 Reporter:  CHEWX         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  5.2.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  rest-api
--------------------------+------------------------------
Changes (by Otto42):

 * focuses:  javascript, rest-api => rest-api
 * severity:  blocker => normal


Comment:

 An attachment's post_status is "inherit", meaning that it inherits the
 status of its parent post.

 This code over in class-wp-posts-rest-controller.php checks the status of
 the parent to determine if the post's parent is readable:

 {{{
                 // Can we read the parent if we're inheriting?
                 if ( 'inherit' === $post->post_status &&
 $post->post_parent > 0 ) {
                         $parent = get_post( $post->post_parent );
                         if ( $parent ) {
                                 return $this->check_read_permission(
 $parent );
                         }
                 }
 }}}

 If the parent post is trashed, then it is not readable, which makes the
 attachment item also not readable.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47782#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list