Fetch wordpress video attachment with post ID

So I have wasted 5 hours of my life to figure how to fetch wordpress custom post videos and been unsuccessful and here i am. Looking for expert advice.

My Requirement:
– Fetch all video attachments of a custom post.
– Display all videos url in frontend by a foreach loop with the post ID with custom html and css.

What I did:

– Everything
– get_attached_media(‘vidoe’, $post_ID); // didn’t work
– wp_query(.. with arguements) //didn’t work
– get_post(with argument on post_type=attachment and post_parent = $post_id) // didn’t work
-get_children (with argument on post_type=attachment and post_parent = $post_id) // didn’t work

What i get :
– Image can be retrived but not videos..

Help me understand how it is done?

Read more here:: Fetch wordpress video attachment with post ID

Leave a Reply

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