Using the WordPress TinyMCE in an HTML iframe for plugin

I have a WordPress plugin with settings page. On this settings page, the form to be submitted is loaded in an iframe. I wish to utilize the WordPress TinyMCE for a textarea in this form.

How do I achieve this? I can’t really do it the way it is stated here (http://keighl.com/post/tinymce-in-wordpress-plugins/) since the form is present in an HTML file.

Related posts

Leave a Reply

1 comment

  1. WORDPRESS 3.5 UPDATE BELOW

    If you’re using WordPress version<3.0, you can use the post you referenced to, it’s great.

    If your wordpress version is above 3.0 (aka newer versions) you can’t use the wp_tiny_mce function for the tiny_mce, because it’s deprecated. You need the newer function, wp_editor, which you can read all about it in here:

    http://codex.wordpress.org/Function_Reference/wp_editor

    For you to use of the wp_editor function and other WP elements your iframe (the for now containing only html and not linked into wp), you need to make your the iframe html file a php file, and add a require function of wp-load.php file.

    For example, if your iframe file is in your server’s root folder with your wordpress install, all you need to do is to place the following in the top of your file:

    <?php 
    require('./wp-load.php'); 
    ?>
    
    //iframe html/php code here
    

    After you do that you can use any wordpress function in your iframe, including the tiny_mce.

    —- UPDATE —-

    If you are using wordpress 3.5 or higher, the implement method has slightly changed. more information is right in this short tutorial