Changing the media library default tab

The question:

› Moderator Notice ‹

This question exists as it fills a specific criterion and/or has historical significance. The current answers do not work for current WordPress versions. If you got a working solution, please add it as a new answer. If you got the exact same question, you could offer a bounty to attract working solutions.

When adding media to the post from Media Library, an iframe that opens in a popup has these tabs:

  1. From Computer
  2. From URL
  3. Media Library

From Computer is currently the default, but I almost never use it and switching to Media Library takes up about 3-4 seconds every time, I wonder if its possible somehow to make it the default instead?


The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

There’s a filter called media_upload_default_tab that you can use to do this.

add_filter('media_upload_default_tab', 'wpse74422_switch_tab');
function wpse74422_switch_tab($tab)
    return 'library';

You can set the to be whatever — assuming the tab exists. The tab keys themselves are found in the functon media_upload_tabs.

 * Defines the default media upload tabs
 * @since 2.5.0
 * @return array default tabs
function media_upload_tabs() {
    $_default_tabs = array(
        'type' => __('From Computer'), // handler action suffix => tab text
        'type_url' => __('From URL'),
        'gallery' => __('Gallery'),
        'library' => __('Media Library')

    return apply_filters('media_upload_tabs', $_default_tabs);

So type (the original default), type_url, gallery, library and any custom tabs are up for grabs. Here is the above in plugin form.

One final note: the media work flow is changing significantly in WordPress 3.5 and this will no longer work. The good news, however, is that the new media popover is much more speedy and your problem is not likely to be an issue.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment