get video poster image by video id

Using wp_query i got list of videos. All videos have their own poster images. How to get them?

To make sure video exists i tried function wp_get_attachment_url and i got video url and its correct.

And I have tried:

get_attached_media(‘video’, $video_id)

but it’s returning empty array

My wp_query object:

WP_Post Object ( [ID] => 3352 [post_author] => 1 [post_date] => 2018-10-07 09:20:29 [post_date_gmt] => 2018-10-07 04:20:29 [post_content] => [post_title] => Placeholder [post_excerpt] => [post_status] => inherit [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => small [to_ping] => [pinged] => [post_modified] => 2018-10-07 09:22:37 [post_modified_gmt] => 2018-10-07 04:22:37 [post_content_filtered] => [post_parent] => 2706 [guid] => http://example.com/wp-content/uploads/2018/03/small.mp4 [menu_order] => 0 [post_type] => attachment [post_mime_type] => video/mp4 [comment_count] => 0 [filter] => raw )

Read more here:: get video poster image by video id

Leave a Reply

Your email address will not be published. Required fields are marked *