Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.