Articles of media model

Only displaying zip files with wp media

I’m using wp.media() to invoke the WordPress media library modal in a custom taxonomy. In the pop up I only want to display zip files. I know I can limit the media library to just audio or video using those keywords but there doesn’t seem to be a comprehensive list of “types” anywhere. How would […]

Show selected images on top in Media Manager

I’ve searched numerous StackOverflow and WordPress Awnsers questions, but I couldn’t find any solution that matches my situation or even remotely points me in the right direction. I have a custom media frame in my plugin where I have pre-selected certain images out of a media library of about 3000 images. However, these pre-selected images […]

Extending wp.media.model, query media from different blog on network and refresh view

I’m trying to extend the new wp.media.model to allow users to be able to choose any blog across the network and pull down the associated media library into the library content view. In the old thickbox we just called switch_to_blog() and refreshed the thickbox. I would like to stay within the new backbone.js media-views and […]

Modify how gallery.js builds the shortcode in tinyMCE?

The post editor helpfully removes default arguments like columns=”3″ from the shortcode. How do you tell it to remove a custom attribute that has a default value? The answer at Enhance Media Manager for Gallery shows how to add a custom attribute to the WordPress 4.0 media manager. That code extends the backbone stuff in […]

Show error, when selecting image in WordPress media uploader if params mismatch

Good day ! My question is following: I know how to show errors while uploading image from WordPress media uploader by using WordPress filter hook: But how to show same error box when user select an image and hit “select” button. I want to add size check of selected image, before inserting. Any ideas how […]

Get File Object from wp.Uploader

I would like to hook into the wp.Uploader and get the FileList object containing the file to be uploaded. So far I’ve been able to extend the uploader using the code below, but I can’t quite seem to find the “before upload” hook. $.extend( wp.Uploader.prototype, { success : function( file_attachment ){ console.log( file_attachment ); } […]

How to get the return value of wp.media({ frame: 'post' }) in all cases?

When the user is in an edit.php page or post-new.php, the wp.media global is available and I want to use it to open a special insertion view that allows videos. var frame = wp.media({ frame: ‘post’ }) frame.open() I don’t seem to get anything out of doing: frame.on(‘select’, function() { console.log(‘Selected!’) }) I also know […]

Perform a custom (bulk) action in media view

I wish to figure out how to add a custom action button in the media grid view ( upload.php screen) and how to perform a custom (bulk) action to the selected attachments, as shown in the screenshot below. I wish to find a way to integrate with the media model instead of force with some […]

How to change the image size in new Media Uploader (ie use medium vs thumbnail)

Is it possible to change the image size of the thumbnails in the new media uploader? For example images are currently displayed using the “thumbnail” image crop size and I would like them to be the “medium” image crop size.

Calling WP Gallery Uploader/Selector From Metabox

When I click the Add Media button on a Post/Page, I have the option to Add Media. After selecting media, I click Insert Into Post, and the images are inserted. However, there is another option, which is on the left sidebar. I can click Create Gallery. The image selecting process is the same, but when […]