Read More
Read More
Menu Close

    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.

    Start your headless eCommerce
    now.
    Read More

    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!

    . . .
    Discuss on Helpdesk

    Leave a Comment

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


    4 comments

  • quyle92
    thanks for useful post…
    • Priya Singh (Moderator)
      Hello There,
      Thanks for the appreciation.
      In case of further queries please mail us at [email protected].
      With Regards,
      Webkul Team
  • Luděk Černý
    Great article, saved me from a headache! 🙂
    • Archana Tiwari (Moderator)
      Hello There,
      Thanks for the appreciation.
      In case of further queries please mail us at [email protected].
      With Regards,
      Webkul Team
  • Back to Top

    Table of Content