Remove HTML editor and visual/HTML tabs from TinyMCE

Is it possible to remove the Visual HTML tabs from wp_editor and display only the TinyMCE editor?

Basically, right now, I’m using wp_editor to display the smallest possible TinyMCE editor I can – only one button is needed, italics.

Read More

Current TinyMCE instnace

What I’d like to do is make that smaller by removing the Visual HTML tabs. Our authors won’t ever need the HTML editor and the custom buttons I’m creating will only be accessible from the visual editor.

NOTE: For reasons found here, I can’t use the teeny argument of wp_editor.

Thanks in advance,

Related posts

Leave a Reply

6 comments

  1. I was hunting for a way to disable the ‘Text’ tab for all users, and nowhere did I see the filter below mentioned.

    This worked for me:

    function my_editor_settings($settings) {
    $settings['quicktags'] = false;
    return $settings;
    }
    
    add_filter('wp_editor_settings', 'my_editor_settings');
    
  2. The code provided by ungestaltbar works great, but I wanted it to work for bbPress (2.2.x) as well. I found this to be very easy and clean as well;

    In the template files (only copy the files you need from
    wp-content/plugins/bbpress/templates/default/bbpress to your theme folder, into a folder called bbpress, for example wp-content/themes/mytheme/bbpress) you’ll find numerous calls to:

    bbp_the_content( array( 'context' => 'reply' ) );
    

    In your template files replace a call like this with (ie. add: ‘quicktags’ => false);

    bbp_the_content( array( 'context' => 'reply', 'quicktags' => false ) );
    

    The calls can be found in all form-xyz.php files.

  3. You can hide both from view using this code in your theme’s functions.php file:

    //Hide Post Page Options from ALL users
    function hide_all_post_page_options() {
    global $post;
    $hide_all_post_options = "<style type="text/css"> #content-html, #content-tmce { display: none !important; }</style>";
    print($hide_all_post_options);
    }
    add_action( 'admin_head', 'hide_all_post_page_options'  );
    
  4. add_filter( 'admin_footer', 'removes_editor_visual_tab', 99 );
    
    function removes_editor_visual_tab()
    {
        ?>
        <style type="text/css">
        a#content-tmce, a#content-tmce:hover {
            display:none;
        }
        </style>';
        <script type="text/javascript">
        jQuery(document).ready(function() {
            document.getElementById("content-tmce").onclick = 'none';
        });
        </script>'
        <?php
    }