I'm displaying TinyMCE in my plugin's settings using wp_tiny_mce():

<?php wp_tiny_mce( false , array("editor_selector" => "a_nice_textarea"));?>

<textarea class="a_nice_textarea" id="a_nice_textarea" name="a_nice_textarea"></textarea>

Everything works as expected but I want to display the HTML editor ONLY but wp_tiny_mce seems to output only the Visual Editor.

I know these are initial settings, but I've been playing with them for some time now without any luck:

// TinyMCE init settings
$initArray = array (
    'mode'                              => 'none',
    'onpageload'                        => 'switchEditors.edInit',
    'width'                             => '100%',
    'theme'                             => 'advanced',
    'skin'                              => 'wp_theme',
    'theme_advanced_buttons1'           => "$mce_buttons",
    'theme_advanced_buttons2'           => "$mce_buttons_2",
    'theme_advanced_buttons3'           => "$mce_buttons_3",
    'theme_advanced_buttons4'           => "$mce_buttons_4",
    'language'                          => "$mce_locale",
    'spellchecker_languages'            => "$mce_spellchecker_languages",
    'theme_advanced_toolbar_location'   => 'top',
    'theme_advanced_toolbar_align'      => 'left',
    'theme_advanced_statusbar_location' => 'bottom',
    'theme_advanced_resizing'           => true,
    'theme_advanced_resize_horizontal'  => false,
    'dialog_type'                       => 'modal',
    'relative_urls'                     => false,
    'remove_script_host'                => false,
    'convert_urls'                      => false,
    'apply_source_formatting'           => false,
    'remove_linebreaks'                 => true,
    'paste_convert_middot_lists'        => true,
    'paste_remove_spans'                => true,
    'paste_remove_styles'               => true,
    'gecko_spellcheck'                  => true,
    'entities'                          => '38,amp,60,lt,62,gt',
    'accessibility_focus'               => true,
    'tab_focus'                         => ':prev,:next',
    'content_css'                       => "$mce_css",
    'save_callback'                     => 'switchEditors.saveCallback',
    'wpeditimage_disable_captions'      => $no_captions,
    'plugins'                           => "$plugins"

Here's even a pretty good explanation of the problem and kind of a solution, but the code provided doesn't work for me either (and doesn't do exactly what I want to achieve):


Any hints?


After analyzing sources of /wp-admin/ I realized that TinyMCE HTML view is just another textarea...

Anyways, here's the answer (everything works like a charm excepting the "img" button, but you can hide it easily with CSS - #ed_img {display: none} ).

<div id="postdivrich" class="postarea">

    <div id="editor-toolbar">
       <script type='text/javascript' src='http://localhost/wordpress/wp-includes/js/quicktags.js?ver=20110502'></script>
       <script type="text/javascript">edToolbar()</script>

    <div id='editorcontainer'>
       <textarea rows='20' cols='40' tabindex='2' id='content' name="your_name"></textarea>

    <script type="text/javascript">
       edCanvas = document.getElementById('content');

    <table id="post-status-info" cellspacing="0"><tbody><tr><td><span>Textarea's description</span></td></tr></tbody></table>


Oh, and of course this is just a source "copypasta", don't forget to enqueue quicktags.js.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.