Support » Plugins » Hacks » Media Uploader Default View

  • Hello,

    (I opened this topic in plugins & hack section by mistake a few days ago, so if you are viewing it for second time, sorry, my bad)

    there was one topic that is discussed in now closed thread is default attachments view of new media uploader. People (including me) say that default view for attachments should be uploaded this post instead of all. I looked on this forum and googled it but couldn’t find a solution. Then decided to dig in the core.

    I dug into the wp-includes/js/media-view.js file. I don’t know about backbone so after a while I became stuck. Below there is a messy code it tried(I copied the method and changed the value). Hope it will be a good starting point. All I want to do is set the default value of attachment-filters to ‘uploaded’ and update the view below (I think its attachments-browser) according to this.

    Can someone with backbone knowledge can help, so we can make it into a plugin or snippet.

    add_action( 'admin_footer-post-new.php', 'by_media_default' );
    add_action( 'admin_footer-post.php', 'by_media_default' );
    function by_media_default()
    <script type="text/javascript">
 =  function() {
    		var model = this.model,
    			value = 'uploaded',
    			props = model.toJSON();
    		_.find( this.filters, function( filter, id ) {
    			var equal = _.all( filter.props, function( prop, key ) {
    				return prop === ( _.isUndefined( props[ key ] ) ? null : props[ key ] );
    			if ( equal )
    				return value = id;
    		this.$el.val( value );
    <?php }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Media Uploader Default View’ is closed to new replies.