How to make “Upload files”selected by default in Insert Media?

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

Related posts

Leave a Reply

2 comments

  1. 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. 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' );