mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@57603 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -77,7 +77,16 @@ abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C
|
||||
$this->assertSame( get_page_template_slug( $post->ID ), $data['template'] );
|
||||
}
|
||||
|
||||
if ( post_type_supports( $post->post_type, 'thumbnail' ) ) {
|
||||
if (
|
||||
post_type_supports( $post->post_type, 'thumbnail' ) ||
|
||||
(
|
||||
'attachment' === $post->post_type &&
|
||||
(
|
||||
post_type_supports( 'attachment:audio', 'thumbnail' ) ||
|
||||
post_type_supports( 'attachment:video', 'thumbnail' )
|
||||
)
|
||||
)
|
||||
) {
|
||||
$this->assertSame( (int) get_post_thumbnail_id( $post->ID ), $data['featured_media'] );
|
||||
} else {
|
||||
$this->assertArrayNotHasKey( 'featured_media', $data );
|
||||
|
||||
Reference in New Issue
Block a user