Is there a way to specify the tab to display when the Media Uploader is displayed?

The following code will select a custom tab labeled Your Tab Name when launching the Media Library for the first time. add_action( ‘admin_footer-post-new.php’, ‘wpse_default_media_library_tab’ ); add_action( ‘admin_footer-post.php’, ‘wpse_default_media_library_tab’ ); function wpse_default_media_library_tab() { ?> <script type=”text/javascript”> var my_tab_has_been_activated = 0; (function($) { $(document).ready( function() { // http://wordpress-hackers.1065353.n5.nabble.com/JavaScript-events-on-media-popup-td42941.html $(document.body).on( ‘click’, ‘.insert-media’, function( event ) { if ( … Read more

Remove the columns in media library

The hook for these columns is manage_media_columns. So just filter the columns here: add_filter( ‘manage_media_columns’, ‘wpse_77687_remove_media_columns’ ); function wpse_77687_remove_media_columns( $columns ) { unset( $columns[‘author’] ); unset( $columns[‘comments’] ); return $columns; }

Add file name column to media library

Here you go, this code not only lists all filenames in Library but also allows you to sort them by name: // Add the column function filename_column( $cols ) { $cols[“filename”] = “Filename”; return $cols; } // Display filenames function filename_value( $column_name, $id ) { $meta = wp_get_attachment_metadata( $id ); echo substr( strrchr( $meta[‘file’], “https://wordpress.stackexchange.com/” … Read more

WP 3.5 media uploader API set selected item

I found the solution from here: https://stackoverflow.com/questions/13936080/pre-select-images-when-opening-wordpress-3-5-media-manager And it works. Here’s my modification and this is using a single-image select media frame: frame.on(‘open’, function(){ var selection = frame.state().get(‘selection’); var selected = $(‘#image-id’).val(); // the id of the image if (selected) { selection.add(wp.media.attachment(selected)); } });