Force WordPress 3.3 to use Flash uploader

Context

Searching for .swf in the Core, found this in /wp-admin/includes/media.php:

$plupload_init = array(
    'runtimes' => 'html5,silverlight,flash,html4',
    'browse_button' => 'plupload-browse-button',
    'container' => 'plupload-upload-ui',
    'drop_element' => 'drag-drop-area',
    'file_data_name' => 'async-upload',
    'multiple_queues' => true,
    'max_file_size' => $max_upload_size . 'b',
    'url' => $upload_action_url,
    'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
    'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
    'filters' => array( array('title' => __( 'Allowed Files' ), 'extensions' => '*') ),
    'multipart' => true,
    'urlstream_upload' => true,
    'multipart_params' => $post_params
);

$plupload_init = apply_filters( 'plupload_init', $plupload_init );

Solution

Applying the following filter hook seems to do the job: (in WP 3.4.1)

add_filter('plupload_init', 'wpse_38603_flash_uploader', 10, 1);

function wpse_38603_flash_uploader( $plupload_init )
{
    $plupload_init['runtimes'] = 'flash,html5,silverlight,html4';
    return $plupload_init;
}

Leave a Comment