I’m wondering how to make WP3.5 media uploader return 2 or more items in attachement
? It always runs once even if 2 items are selected. The code:
$('.button').on('click', function(){
var send_attachment_backup = wp.media.editor.send.attachment;
wp.media.editor.send.attachment = function(props, attachment){
myFunction(attachment.url);
wp.media.editor.send.attachment = send_attachment_backup;
}
wp.media.editor.open();
});
EDIT: My mistake. I’m doing wp.media.editor.send.attachment = send_attachment_backup;
and it runs once. So the new questions would be: how to restore the original function after the latest item in the loop?
I’d sugest you to properly handle new media modal integration. There’s no need to hijack wp.media.editor object’s attributes in order to use media modal in your plugins. You can inspire yourself from a demo integration plugin at github
Demo #4 best suits your needs I guess