解决方法很简单:
挂接自定义。将js脚本上传到media upload thickbox,以便它在iFrame内运行:
function admin_styles_scripts_media_upload() {
wp_register_script(\'mediajs\', get_template_directory_uri().\'/js/button.js\', array(\'jquery\'), true);
wp_enqueue_script(\'mediajs\');
}
add_action(\'admin_print_scripts-media-upload-popup\',\'admin_styles_scripts_media_upload\');
?>
使用脚本将默认的保存按钮替换为自定义按钮,然后调用
self.parent.tb_remove
因此:
jQuery(document).ready(function() {
jQuery(\'<a href="#" id="back_to_admin" class="button">Voltar para Edição</a>\').insertAfter(\'.ml-submit\');
jQuery(\'.savebutton.ml-submit\').detach();
jQuery(\'a.toggle\').live("remove");
jQuery(\'#back_to_admin\').live(\'click\',function() {
parent.uploadedImages();
self.parent.tb_remove();
});
});