12

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.

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,

1

6 Answers 6

21

Just set 'quicktags' parameter of the settings array to false.

wp_editor('', 'some-id', array('quicktags' => false) );
1
  • No idea why I didn't think of this. Thanks!
    – turbonerd
    Commented Apr 18, 2012 at 12:56
3

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');
1

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.

1

Here is a simple, yet clean way

//  Remove visual option and tabs
add_filter( 'user_can_richedit' , '__return_false', 50 );
0

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'  );
3
  • Hi Travis. This has had no effect on my page, even when I simply add those lines to my plugin's CSS file.
    – turbonerd
    Commented Apr 16, 2012 at 15:13
  • Quite honestly, I am no coder. This is the code I always use to hide areas of the new post page. I just add it to my theme's functions.php file and have never had any problems. I can tell you though, the css that styles the tabs is located in /wp-includes/css/editor-buttons.css. Commented Apr 16, 2012 at 15:32
  • You might want to try to clear your cache after implementing the above code. I have used it in code on a new site today and tested it on an existing site. Both worked perfectly. Commented Apr 16, 2012 at 20:14
-1
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
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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