diff --git a/src/wp-admin/js/widgets/media-widgets.js b/src/wp-admin/js/widgets/media-widgets.js index c4f23e1cda..452a9e38eb 100644 --- a/src/wp-admin/js/widgets/media-widgets.js +++ b/src/wp-admin/js/widgets/media-widgets.js @@ -708,10 +708,14 @@ wp.mediaWidgets = ( function( $ ) { control.model.set( control.getModelPropsFromMediaFrame( mediaFrame ) ); }); - // Disable syncing of attachment changes back to server. See . + // Disable syncing of attachment changes back to server (except for deletions). See . defaultSync = wp.media.model.Attachment.prototype.sync; - wp.media.model.Attachment.prototype.sync = function rejectedSync() { - return $.Deferred().rejectWith( this ).promise(); + wp.media.model.Attachment.prototype.sync = function( method ) { + if ( 'delete' === method ) { + return defaultSync.apply( this, arguments ); + } else { + return $.Deferred().rejectWith( this ).promise(); + } }; mediaFrame.on( 'close', function onClose() { wp.media.model.Attachment.prototype.sync = defaultSync;