Get attachment thumbnail from get_posts function
How do I get the id of the most recent wordpress audio media upload. The reason for this is that I want to use audio cover images/ featured images as a post featured image. Do I need to retrieve the ID of the thumbnail in the audio.
I tried the code below but it returned error
$attachments = get_posts( array(
'post_type' = 'attachment',
'posts_per_page' = 1,
'post_status' = null,
'post_mime_type' = 'audio'
) );
foreach ( $attachments as $attachment ) {
$post_id = get_post_thumbnail_id( $attachment-ID);
}
Topic featured-post Wordpress
Category Web