16

I am frustrated having to click on the "Upload Files" constantly instead of the first choice being Upload Files in posts editor....How can i make “Upload files” selected by default instead of "Media library"?

1
  • 3
    It's worth noting that you can drag and drop files and initiate upload while in the "media library" panel without having to actually click "upload files" first.
    – Milo
    Apr 20, 2013 at 1:32

2 Answers 2

17

Add this to your functions.php, or preferably a functionality plugin.

add_action( 'admin_footer-post-new.php', 'media_manager_default' );
add_action( 'admin_footer-post.php', 'media_manager_default' );

function media_manager_default() {
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function($){
            wp.media.controller.Library.prototype.defaults.contentUserSetting=false;
        });
    </script>
    <?php
}
2
  • 6
    Damn dude how deep into core did you have to go to pull that one out? Apr 19, 2013 at 23:54
  • Changed it to: jQuery(".media-router a:first-child").addClass("active"); jQuery(".media-router a:last-child").remveClass("active"); And it worked (posting here because of request) Jun 13, 2016 at 9:14
4

If some one it's still looking for a solution, this solution worked for me for all upload images in any post types and on featured images as well:

function upload_media_manager_by_default() {
  if ( did_action( 'wp_enqueue_media' ) ) {
    ?>
    <script type="text/javascript">
      jQuery( document ).ready( function ( $ ) {
        wp.media.controller.Library.prototype.defaults.contentUserSetting = false;
        wp.media.controller.FeaturedImage.prototype.defaults.contentUserSetting = false;
      });
    </script>
  <?php
  }
}

add_action( 'admin_footer', 'upload_media_manager_by_default' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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