I have multiple tiny_mce instances on a metabox in the media-upload.php page.
This works fine and displays / saves text fine by calling:
wp_tiny_mce(true,
array(
"editor_selector" => "my_text_box"
)
);
The problem is that the hyperlink pop box doesn't link correctly. The box pops up ok, but then when you click 'add link' the whole page refreshes.
I think it's down to the tiny_mce not targetting the text box because there are multiple instances of it.
So I tried this method:
// important: note the priority of 99, the js needs to be placed after tinymce loads
add_action('admin_print_footer_scripts','my_admin_print_footer_scripts',99);
function my_admin_print_footer_scripts() {
?><script type="text/javascript">/* <![CDATA[ */
jQuery(function($)
{
var i=1;
$('.my_text_box textarea').each(function(e)
{
var id = $(this).attr('id');
if (!id)
{
id = 'my_text_box-' + i++;
$(this).attr('id',id);
}
tinyMCE.execCommand('mceAddControl', false, id);
});
});
/* ]]> */</script><?php
}
But that doesn't load any tiny_mce onto any of the boxes.
Any help or ideas?