3

I would very much like to disable the drag and drop upload feature for tinyMCE (both the default one and the wp_editor() one) because it interacts with my custom pop up menus - (WP Trac). Right now I'm trying to just disable the one with the actual WP_Editor() function. For some reason it doesn't seem to actually disable any drag and drop functionality and was wondering if I was doing something wrong. My function call looks like this:

wp_editor($meta_content, 'additionalTab', array(
    'wpautop'           =>  true,
    'media_buttons'     =>  false,
    'textarea_name'     =>  '_additional_content',
    'textarea_rows'     =>  15,
    'teeny'             =>  true,
    'drag_drop_upload'  =>  false
));

The Expected Output is that it should completely disable drag and drop uploads directly to the tinyMCE.

The Actual Output is that it doesn't do anything, it still allows you to drag and drop upload into the tinymce. Is there something wrong with what I'm doing or is there something inherieitnly wrong with wp_editor()?

  • Does this help? – eyoung100 Jun 3 '14 at 14:59
  • That's quite strange, and I'm unable to reproduce it. What version of WordPress are you using? Where are you calling wp_editor? I am unable to reproduce this: setting drag_drop_upload to true enables it for me, and setting it to false disables it. – engelen Jun 9 '14 at 8:44
  • I'm calling it in a metabox callback function. changing it from true to false or vise-versa does nothing for me - it always allows drag / drop upload. I'm running 3.9.1 and I find this happening on multiple installs. – Howdy_McGee Jun 9 '14 at 13:45
  • It seems like if you add more than 1 wp_editor and one is true it makes them all true. I wonder if it's due to the static nature of the _WP_Editors::$drag_drop_upload variable? See github.com/WordPress/WordPress/blob/master/wp-includes/… I believe you said you weren't using wp_editor on both – setterGetter Jul 9 '14 at 20:28
2

you can solve this problem by enqueue the following script with the dependency of jQuery

 jQuery(document).ready(function(){
      tinyMCEPreInit.dragDropUpload = false;
 });

To add the dependency you can refer this link

I have tested this solution and it has worked for me. I hope it will work for you too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.