Opened 6 years ago
Last modified 3 months ago
#41692 assigned defect (bug)
REST API does not return featured_media for Audio/Video
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | has-patch needs-refresh |
Focuses: | Cc: |
Description
Audio and Video attachments can have a featured image. This data is not currently returned by the REST API wp/v2/media
endpoint. Part of the problem is that the schema for attachments is generated by the Post controller, even though the Post controller does not return data for attachments. Because the schema is used by the OPTIONS
endpoint, before knowing what mime-type the attachment is, thumbnail
should be set for attachment's attributes so that featured_media
is added to the responses from wp/v2/media
.
Attachments (2)
Change History (19)
This ticket was mentioned in Slack in #core-restapi by kadamwhite. View the logs.
6 years ago
#3
@
6 years ago
Taking a look at this after discussion in the REST API bug scrub Friday.
Core doesn't register the attachment post type with support for thumbnail
. So just including thumbnail in the fixed schema is causes issues with the ::check_post_data()
unit test method.
The first patch lists featured_media
in the schema as read-write, but it only supports read. This is because the attachments controller doesn't call parent::create_item()
which has the support for setting the featured media.
So that leaves us with three options I think.
- Add
thumbnail
support for the attachments post type and manually update the thumbnail in the attachments controller. I've attached the patch that does this. I have no idea what the ramifications are for listingthumbnail
as supported in the post type, though. - Same as #1, except don't include thumbnail support in the attachment post type and update
::check_post_data
to either use the schema instead ofpost_type_supports()
or just make an exception for the attachment post type. - Continue with the first patch, but mark the featured media schema as
readonly
.
This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.
6 years ago
#5
@
6 years ago
- Milestone changed from 4.9 to Future Release
Punting to future release, per discussion with @TimothyBlynJacobs in this week's REST API team chat
This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.
5 years ago
This ticket was mentioned in Slack in #core-restapi by desrosj. View the logs.
5 years ago
This ticket was mentioned in Slack in #core-restapi by desrosj. View the logs.
4 years ago
This ticket was mentioned in Slack in #core-media by desrosj. View the logs.
4 years ago
#13
@
4 years ago
Per today's bug scrub, @TimothyBlynJacobs will refresh the patch. I also dropped this in #core-media for some additional feedback.
This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.
4 years ago
This ticket was mentioned in Slack in #core-restapi by swissspidy. View the logs.
3 months ago
#17
@
3 months ago
- Milestone changed from Future Release to 6.3
- Owner set to dlh
- Status changed from new to assigned
Per discussion in Slack, I'm going to try to refresh this patch for 6.3.
Makes sense to me.
On the patch, is there a reason to explicitly set
featured_media
? It looks to me like setting in the schema should be enough to add it to the response.