Using WordPress ‘media_upload_flash_bypass()’ PHP function

The media_upload_flash_bypass() WordPress PHP function displays a message to inform users that the multi-file uploader is available when the Flash uploader is disabled.

Usage

media_upload_flash_bypass();

Parameters

  • None

More information

See WordPress Developer Resources: media_upload_flash_bypass

Examples

Displaying the multi-file uploader message on a custom media upload page

This code displays the multi-file uploader message on a custom media upload page.

function custom_media_upload() {
  // Display the multi-file uploader message
  media_upload_flash_bypass();
}
add_action('admin_menu', 'custom_media_upload');

Displaying the message in a custom meta box

This code adds a custom meta box to the post editing screen and displays the multi-file uploader message within it.

function add_custom_meta_box() {
  add_meta_box('custom-media-meta-box', 'Custom Media', 'custom_media_meta_box_callback', 'post');
}
add_action('add_meta_boxes', 'add_custom_meta_box');

function custom_media_meta_box_callback($post) {
  // Display the multi-file uploader message
  media_upload_flash_bypass();
}

Displaying the message in a custom plugin settings page

This code adds a settings page for a custom plugin and displays the multi-file uploader message on that page.

function custom_plugin_menu() {
  add_options_page('Custom Plugin', 'Custom Plugin', 'manage_options', 'custom-plugin', 'custom_plugin_options');
}
add_action('admin_menu', 'custom_plugin_menu');

function custom_plugin_options() {
  // Display the multi-file uploader message
  media_upload_flash_bypass();
}

Displaying the message in a custom theme options page

This code adds a theme options page and displays the multi-file uploader message on that page.

function custom_theme_menu() {
  add_theme_page('Custom Theme', 'Custom Theme', 'edit_theme_options', 'custom-theme', 'custom_theme_options');
}
add_action('admin_menu', 'custom_theme_menu');

function custom_theme_options() {
  // Display the multi-file uploader message
  media_upload_flash_bypass();
}

Displaying the message on a custom widget

This code creates a custom widget and displays the multi-file uploader message within it.

class Custom_Widget extends WP_Widget {
  function __construct() {
    parent::__construct('custom_widget', 'Custom Widget');
  }

  function form($instance) {
    // Display the multi-file uploader message
    media_upload_flash_bypass();
  }
}
add_action('widgets_init', function() {
  register_widget('Custom_Widget');
});