How to use media uploader in wordpress custom plugin

4

If you’re developing own wordpress plugin may be you have to use upload image in the custom field.So in here i’m going to explain all how to use media uploader in your wordpress settings page.

How to use media uploader in wordpress custom plugin

This is my folder structure.
How to use media uploader in wordpress custom plugin

My main file is index.php.There I’m adding wordpress code functions to fetch related files.

Now I’m adding my js file named admin_script.js into settings page.

Okay.Next step is adding html fields to settings page(settins.php) of my plugin page.

Now add the js into the admin_script.js file.

After added all you can see it in admin page as following.

How to use media uploader in wordpress custom plugin

Share.

About Author

Sumith Harshan is the Web Engineer Specializes in Java Script, JQuery, HTML4/5, CSS2/3, PHP, CodeIgniter, CakePHP, J2SE, J2EE, XML, Hacking & Security, Mobile Interface Developing, Magento, Wordpress, Joomla, Drupal,PHPBB,Facebook App Developing and Open cart...etc.

  • Max

    What about scripts? Where are links for the scripts which you added and called from function?

  • Thank you Sumith Harshan. The tutorial helped me a lot to add media uploader for my wordpress plugin http://techsini.com/our-wordpress-plugins/elegant-subscription-popup

  • Hello Sumith,

    We should add window.send_to_editor function inside the button submit brackets and then write return false. Because the above code conflicts with adding images in wp posts or pages.