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.
– 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:
– 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