Extract random videos from my WordPress media library and display it on my Videos page

Hello Friends,

I want to have a page where there is a video player and a “Random” button. The webpage automatically extracts the video urls from the media library and display videos on my webpage. When you click the “Random” button it displays another video from my Media library in random order. This can be done infinite times(I have a video gallery of 200 videos). I have achieved this via simple HTML Codes but I have to write every Video URL manuelly.Is there any way automate this so that the videos are in a loop as soon as I add them in my library. Thank you all!

  1. You’d need to write a query on the backend, and probably a JavaScript trigger to grab the result and append the new video url to the source.

    Feel free to DM me if you need help doing this.


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer