我想知道如何制作WP3。5媒体上载程序返回2个或多个项目attachement
? 即使选择了2个项目,它也始终运行一次。代码:
$(\'.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();
});
编辑:我的错误。我正在做
wp.media.editor.send.attachment = send_attachment_backup;
它只运行一次。因此,新的问题是:
how to restore the original function after the latest item in the loop?