[wp-trac] [WordPress Trac] #41692: REST API does not return featured_media for Audio/Video

WordPress Trac noreply at wordpress.org
Tue Oct 3 03:17:37 UTC 2017


#41692: REST API does not return featured_media for Audio/Video
----------------------------+------------------
 Reporter:  wonderboymusic  |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  4.9
Component:  REST API        |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------

Comment (by TimothyBlynJacobs):

 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.

 1. 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
 listing `thumbnail` as supported in the post type, though.
 2. 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
 of `post_type_supports()` or just make an exception for the attachment
 post type.
 3. Continue with the first patch, but mark the featured media schema as
 `readonly`.

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


More information about the wp-trac mailing list