Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    hyperlocal-marketplace-guide

    How to use WordPress Media Upload in plugin / theme

    Using the WordPress media library in your own plugin/theme will save you a bunch of time. This blog will provide an example of how to use the Media Library in a plugin/theme environment.

    When using wp.media, there are a few things that we are interested. The first one is how to define the media frame.

    ENQUEUE THE SCRIPT

    This article will just show the code snippets that you need to use in order to get everything to work. The rest will be up to you to incorporate into your plugin/theme.

    Form

    We need some html tags in order to select media file and these are:-

    • A text input where we will put the URL of the file we select.
    • A button that will activate the WordPress media library.
    • Finally a submit button so that you can do something with the URL.

    The second thing that we are interested in is how to capture the event when we have selected the image(s) and clicked on the Select button.

    JavaScript Code Example

    Support

    Still have any issue feel free to add a ticket and let us know your views to make the code better https://webkul.uvdesk.com/en/customer/create-ticket/

    Thanks for Your Time! Have a Good Day!

    . . .

    Comments (2)

    Add Your Comment

  • Luděk Černý
    Great article, saved me from a headache! 🙂
    • Archana Tiwari
      Hello There,
      Thanks for the appreciation.
      In case of further queries please mail us at support@webkul.com.
      With Regards,
      Webkul Team
  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close

    Table of Content

    Hide Index