Make WordPress Core


Ignore:
Timestamp:
02/12/2024 10:15:45 PM (2 years ago)
Author:
swissspidy
Message:

REST API: Add featured_media field to attachments endpoint.

Audio and video attachments can have a featured image, also known as a poster image. This functionality is now properly exposed by the wp/v2/media endpoint.

Props swissspidy, timothyblynjacobs, wonderboymusic, dlh, spacedmonkey.
Fixes #41692.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-rest-post-type-controller.php

    r56549 r57603  
    7878        }
    7979
    80         if ( post_type_supports( $post->post_type, 'thumbnail' ) ) {
     80        if (
     81            post_type_supports( $post->post_type, 'thumbnail' ) ||
     82            (
     83                'attachment' === $post->post_type &&
     84                (
     85                    post_type_supports( 'attachment:audio', 'thumbnail' ) ||
     86                    post_type_supports( 'attachment:video', 'thumbnail' )
     87                )
     88            )
     89        ) {
    8190            $this->assertSame( (int) get_post_thumbnail_id( $post->ID ), $data['featured_media'] );
    8291        } else {
Note: See TracChangeset for help on using the changeset viewer.