Support » Plugins » How I can use TinyMCE for my own plugin

  • Hi, I must write a plugin with administration panel, somethig like “Write Post”. I need for WYSIWYG. I know, that WordPress use TinyMCE. But i can’t include it to my Plugin. How can I do it? I’m newbie in WordPress programming. Help me please. Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Bagira
    I guess you can add a new advanced text area by using the ‘the_editor’ function:

    the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2)

    so,for example, if you want to add a new field with the name ‘thoughts_list’
    You can do it this way:


    Hope this helps.

    Thanks, but I have problems with your code :

    the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2)

    the buttons of “Add an Image”, “Add video” and “Visual” doesn’t works, no error and nothing happens.

    The button “HTML” gives me the JavaScript error “switchEditors is not defined”.

    The other problem is that when I write, the text appears in white colour, I only can see what I type if I mark the text.

    What should I do?

    I have this problem too… How I can explain it?

    You could take a look to this very interesting article :

    according to
    you need to enqueue script in wordpress header (for me it’s admin header)

    so :

    function ShowTinyMCE() {
    	// conditions here
    	wp_enqueue_script( 'common' );
    	wp_enqueue_script( 'jquery-color' );
    	if (function_exists('add_thickbox')) add_thickbox();
    	if (function_exists('wp_tiny_mce')) wp_tiny_mce();



    where you want your tinyMCE text area

    Not perfectly working with WP 3.0 (beta) i’m working on it, but you can use it as a text area and media upload work (upload file / add code into text)

    I was actually looking to do this myself last week, and got a different answer, which seems easier to me.
    The page I got the info from in the end was

    Basically, add wp_tiny_mce() into your page with the textarea you want. The override info is all in that link.

    The only thing I found was that many people have had issues using multiple textareas. I have it working quite successfully, as long as you make sure that they have the same class and id, but different names.

    I’ve had nothing but issues trying to use the built-in TinyMCE editor with the_editor or wp_tiny_mce when needing multiple editors on one page. The best results would probably to put together the JS separately and link those files to the WP included ones — but circumvent the use of the default WP functions for TinyMCE. Only in this way do I believe I can make TinyMCE finally work multiple times the way it’s expected.

    The default code like the_editor and wp_tiny_mce just aren’t built to be used multiple times on a page and have their many limits.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How I can use TinyMCE for my own plugin’ is closed to new replies.