How to Call TinyMCE Editor in a WordPress plugin

x theme
(Last Updated On: July 10, 2014)

If you’re developing a WordPress plugin, and in any part of your plugin you want to show tinyMCE editor, then following is a code snippet to Call TinyMCE Editor in a WordPress plugin.

The following code will help you to attach the tinyMCE editor to a textarea in wordpress:

add_action("admin_head","load_custom_wp_tiny_mce");
function load_custom_wp_tiny_mce() {

if (function_exists('wp_tiny_mce')) {

add_filter('teeny_mce_before_init', create_function('$a', '
$a["theme"] = "advanced";
$a["skin"] = "wp_theme";
$a["height"] = "200";
$a["width"] = "800";
$a["onpageload"] = "";
$a["mode"] = "exact";
$a["elements"] = "intro";
$a["editor_selector"] = "mceEditor";
$a["plugins"] = "safari,inlinepopups,spellchecker";

$a["forced_root_block"] = false;
$a["force_br_newlines"] = true;
$a["force_p_newlines"] = false;
$a["convert_newlines_to_brs"] = true;

return $a;'));

wp_tiny_mce(true);
}
}

Related posts:

About the author

admin

Leave a Reply

Your email address will not be published. Required fields are marked *