• MACscr

    (@macscr)


    I am creating a plugin that uses the media-upload.php setup, etc. I followed this great tutorial: https://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/

    The problem though is that when I follow the directions, it works fine for the plugin, but now i cant use the media uploader for the actual post content when the plugin is active. What would be the proper method for using the media uploader for insert file paths into my custom meta box, but still be able to use the media uploader with the regular post content as well?

Viewing 1 replies (of 1 total)
  • alpha_llama

    (@alpha_llama)

    11-month-old post atm, but here’s your answer:

    Did you conditionally add your upload script based on the $_GET[page] variable? From, the link you posted they did this:

    if (isset($_GET['page']) && $_GET['page'] == 'my_plugin_page') {
       add_action('admin_print_scripts', 'my_admin_scripts');
       add_action('admin_print_styles', 'my_admin_styles');
    }

    If you didn’t, the the replacement send_to_editor() function will be on every page (including your add/edit post admin pages) and the media uploader won’t behave the way it normally does.

    You can check to see if your ‘my_admin_scripts’ are being loaded by viewing the page source and looking to see if your script is in the head (my-script.js if you’re using the tutorial verbatum.)

    Good luck.

Viewing 1 replies (of 1 total)
  • The topic ‘creating custom plugin that uses media uploader’ is closed to new replies.