jQuery(document).ready(function(a){function b(b){var c=!0,d=wp.media.editor.send.attachment;a("body").on("click",b,function(b){var e="#"+a(this).attr("id"),h=(a(e),wp.media.editor.send.attachment,a(e));h.attr("id").replace("_button","");return c=!0,wp.media.editor.send.attachment=function(b,f){return c?(a(".custom_media_id").val(f.id),a(".custom_media_url").val(f.url),a(".custom_media_image").attr("src",f.url).css("display","block"),void 0):d.apply(e,[b,f])},wp.media.editor.open(h),!1})}b(".custom_media_button.button")});