Home > UI/UX Development > JavaScript > Add Videos using media upload URL in WordPress

Add Videos using media upload URL in WordPress

We have seen how to add WordPress media upload button in a page or metabox. You can find the steps here.
Similarly you can also add a media upload button for videos, since the above link has media upload type as image

media-upload.php?type=image&TB_iframe=true

How do we upload videos instead? Follow the steps below:

  1. Add the media upload button in your metabox/frontend
  2. Add script to open media upload window(localize and enqueue the script file where you add the below code)

     

  3. Add the following code to functions.php
  4. Here I am saving the attachment ID and while displaying the page use attachment ID to retrieve details of the video.
This Article is TAGGED in , , . BOOKMARK THE permalink.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">