Title: Multiple tiny_mce instances, hyperlink issues
Last modified: August 20, 2016

---

# Multiple tiny_mce instances, hyperlink issues

 *  [lsatdown](https://wordpress.org/support/users/lsatdown/)
 * (@lsatdown)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/multiple-tiny_mce-instances-hyperlink-issues/)
 * 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?

Viewing 1 replies (of 1 total)

 *  Thread Starter [lsatdown](https://wordpress.org/support/users/lsatdown/)
 * (@lsatdown)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/multiple-tiny_mce-instances-hyperlink-issues/#post-2333936)
 * I;ve noticed that if you change the main editor to ‘HTML’ from ‘Visual’, and 
   refresh the page, the links work fine?!
 * So it seems the main editor javascript is affecting the multiple tinymce instances
   somehow?

Viewing 1 replies (of 1 total)

The topic ‘Multiple tiny_mce instances, hyperlink issues’ is closed to new replies.

## Tags

 * [hyperlink](https://wordpress.org/support/topic-tag/hyperlink/)
 * [tiny_mce](https://wordpress.org/support/topic-tag/tiny_mce/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [lsatdown](https://wordpress.org/support/users/lsatdown/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/multiple-tiny_mce-instances-hyperlink-issues/#post-2333936)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
