Tag: web development

so i’ve been running into a nagging issue with wordpress’ new instance of its media uploader (released in v3.5)

if i had a meta box with an image uploader, it would conflict with the standard “Add Media” button for the editor

previous code

uploader.js

jQuery(document).ready(function() {
var form_field;
jQuery('.button-upload').click(function() {
form_field = '#' + jQuery(this).next('input').attr('id');
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
return false;
});

window.send_to_editor = function(html) {
imgurl = jQuery('img',html).attr('src');
if(!imgurl){
imgurl = jQuery(html).attr('src');
}
if (jQuery(form_field).length > 0) {
jQuery(form_field).val(imgurl);
}
tb_remove();
}
});

Read more »