How to trigger a refresh in the media modal

I’m developing a plugin that adds a new tab to the media modal, and I need to know a way trigger a refresh of the attachments tab so it shows newly added attachments. This is the code I’m using: wp.media.view.Toolbar.Custom = wp.media.view.Toolbar.extend({ initialize: function() { _.defaults( this.options, { event: ‘custom_event’, close: false, items: { custom_event: … Read more

Delete an attachment in the WP media modal window

I’m trying to create an option in the WP modal media window to detect duplicate files and delete a newer file if an older duplicate is found. I have the following code working (in conjunction with the ‘attachment_fields_to_edit’ filter) to deselect a duplicate file and select the original file in the media modal. What I’d … Read more

Enhance Media Manager for Gallery

I would like to enhance the Media Editor, after WordPress 3.5, on the gallery view. I want to add a new select field on the right side and send the selected values to the gallery shortcode. I think, the function wp.media.gallery in wp-includes/js/media-editor.js is the default function to insert the gallery shortcode. I want to … Read more