Skip to content

Instantly share code, notes, and snippets.

Created January 4, 2013 12:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/4452118 to your computer and use it in GitHub Desktop.
var me = wp.media.editor;
// backup the original method
var orig = me.send.attachment;
// set our own function
me.send.attachment = myCallback;
// open our instance of the media uploader and bind to escape/insert method
me.open("myinstance").on("escape insert",function () {
// get our instance back and unbind all our event listeners
me.get("myinstance").off(null,null,this);
// restore original method
me.send.attachment = orig;
},this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment