Plupload 2.x in WordPress 3.9
Plupload is the library that powers most of the file upload interfaces in WordPress, and in 3.9 we’ve updated the bundled library to version 2.1.1 (#25663). Here are some of things that have changed, which may affect WordPress plugins and themes.
If you’re using direct references to Plupload’s runtime .js files, such as plupload.html5.js, note that these files are now gone. The following script handles were removed: plupload-html5
, plupload-flash
, plupload-silverlight
and plupload-html4
. If you need to enqueue the Plupload library, just use the plupload
handle.
If you’re constructing your own Plupload settings array vs. using wp_plupload_default_settings()
and/or the _wpPluploadSettings
object, note that some of the arguments have changed, most notably:
(See update)flash_swf_url
should point to the new Moxie.swf fileSimilarly,(See update)silverlight_xap_url
should use the new Moxie.xap- The
multiple_queues
argument is no longer used - The
max_file_size
key has been moved to thefilters
array - The
filters
array now supports multiple keys, and the list of file types array has been moved to itsmime_types
key
To illustrate that with code:
$settings = array( // ... 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ), // Unchanged 'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ), // Unchanged 'filters' => array( 'max_file_size' => $max_upload_size . 'b', ), );
Plupload version 2.1.1 has also added some exciting new options and methods, which you can find in the updated documentation.
As a result of this update in WordPress 3.9 we were able to add drag and drop upload support directly to our TinyMCE editor (#19845), and we’ve also added a new boolean flag to wp_editor()
, which you can use to enable drag and drop upload support in your own instance of the editor (#27465):
wp_editor( '', 'my-editor', array( // ... 'drag_drop_upload' => true, ) );
If you run into any problems with this update in 3.9, please leave a comment on this post and we’ll be happy to help you out!
Update: I opened #27763 to address some of the compatibility issues around the update. We might be renaming the swf/xap files for backwards compatibility.
Update, April 13: The original swf/xap filenames were restored.
Andrew Nacin 1:20 am on April 14, 2014 Permalink
Post updated to reflect changes via #27763.
experiencedbadmom 11:54 am on April 18, 2014 Permalink
Thank you for the link to the manual instructions. My blog is experiencedbadmom.com tho, not experiencedbadmom.com/wordpress/ – does that matter? Also, one of the steps says to deactivate plugins – how am I to deactivate plugins if I can’t even get into my dashboard? GoDaddy is my host – do I deactivate plugins somewhere on their servers?
experiencedbadmom 11:55 am on April 18, 2014 Permalink
Sorry, wrong thread. My apologies.
Najeeb 6:16 am on April 21, 2014 Permalink
Hello there,
well I am using pluploader library in my plugin and when try ‘plupload’ handle to use shipped scripts it not applying to my uploader object, even I can see libraries are loading. Any help will be much appreciated.
Cheers.
Konstantin Kovshenin 7:32 am on April 21, 2014 Permalink
Hi there! Can you please provide more details, like a code sample? Also, has it worked in 3.8 and broken in 3.9 or does it just not work in general? Thanks!
pbusardo 7:13 pm on April 21, 2014 Permalink
Perhaps this is relevant. I believe the FLA gallery uses Plupload. When I try to upload multiple files to the gallery, the GUI no longer appears.