Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

› 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?

Thanks

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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

<?php
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.

<?php
/**
 * 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.

share|improve this answer
    
Awesome, thanks heaps, you just saved me ateast an hour each day! :D –  Nimbuz Nov 30 '12 at 5:23
    
This 'media_upload_default_tab' filter trick does work in 3.5, actually. But you are right, the workflow is different. –  Ollie Jones Dec 15 '12 at 0:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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