WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 5 weeks ago

#41445 new defect (bug)

post_parent can prevent media from embedding correctly

Reported by: loboyle Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.3
Component: REST API Keywords: needs-patch
Focuses: rest-api Cc:

Description

If media is uploaded for a post, then used as a featured image on another post, and the original parent is not accessible via the REST API (e.g. because it's in the trash, not published etc), then it cannot be embedded on the post that is accessible.

To reproduce

  • make a new post with a featured image
  • trash the post
  • make a new post, using the first image as the featured image
  • request the second post over the rest API with media embedding enabled

The media will not be embedded, instead a forbidden result will be embedded error

{
  "wp:featuredmedia":[  
     {  
        "code":"rest_forbidden",
        "message":"You don't have permission to do this.",
        "data":{  
           "status":403
        }
     }
  ]
}

See https://github.com/WP-API/WP-API/issues/2596 for the original issue. Also related is https://core.trac.wordpress.org/ticket/30691.

Change History (8)

This ticket was mentioned in Slack in #core by kadamwhite. View the logs.


4 months ago

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


4 months ago

#3 @ritter.aaron
4 months ago

we experience the same issue, with the difference that the image was first uploaded to the library via Medialibrary and then attached to a pods post in to a field without any meta data (basicaly using pods with additional fields in table) (which works) and then attached to a blog post which showed the same issue with permission denied 403 (when directly attaching to the post it worked)

one more thing i found is that when attaching to the post the file name gets truncated

when uploading via media library it does not get truncated

This ticket was mentioned in Slack in #core-restapi by kadamwhite. View the logs.


3 months ago

#5 @benjamincreative
2 months ago

  • Version 4.7.5 deleted

Same here on 4.8.2

Uploaded to one custom post type as draft, added to another public custom post type...

This ticket was mentioned in Slack in #core by virusakos. View the logs.


6 weeks ago

#7 @riobahtiar
5 weeks ago

  • Focuses rest-api added
  • Keywords needs-patch added
  • Version set to 4.8.3

Hi All, Any updates for this ticket?

Because I just experienced the same issue,

WordPress Version 4.8.3

#8 @mythovik
5 weeks ago

In my case was a jpg error. Some images make this error:

After a while i discover that is about the name of the pic, in my case:

PeñaNieto.jpg

The "ñ" and other special chars, could cause this error.

Note: See TracTickets for help on using tickets.