This was solved as simply as:
-
Hooking a custom .js script to the media-upload thickbox, so that it runs inside the 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'); ?>
-
Use the script to replace the default Save button with a custom one, and call
self.parent.tb_remove
from that: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(); }); });