I would like to ask whether there is a function to remove/turn off the Text tab for users ?

Enough good codes here to make a clean CMS, only this one I can not find.


  • I honestly like that the tab is there, because it let's users with more experience make some more advanced edits. However I can see how having that can be an issue. I upvoted this question. – gdaniel Aug 8 '14 at 21:12

This requires two steps:

1) First, we need to hide the editor tabs, which can be accomplished easily enough using CSS. We'll output some CSS to the admin head to do that:

function hide_editor_tabs() {
    global $pagenow;

    // Only output the CSS if we're on the edit post or add new post screens.
    if ( ! ( 'post.php' == $pagenow || 'post-new.php' == $pagenow ) ) {

    .wp-editor-tabs {
        display: none;

add_action( 'admin_head', 'hide_editor_tabs' );

Keep in mind that while we could hide only one of the tabs, like the OP requested, we should actually hide both of them. Since there are only two of them total, it would not make any sense to hide only one, and then have one tab remaining, which would then have no purpose.

2) Next, we need to force the visual editor to be the default. Since we have hidden the tabs in step one, users will not be able to switch away from the default.

function force_default_editor() {
    return 'tinymce';
add_filter( 'wp_default_editor', 'force_default_editor' );

If you want to force the text editor instead, just change return 'tinymce'; to return 'text'; in step 2.

  • Should also check if ( user_can_richedit() ) { } inside the first function – Bryan Willis Aug 11 '14 at 10:04

Adding to my comment on the accepted answer you should do this as well otherwise they can just change it on their profile page which defeats the purpose of the other functions. You can even go ahead and house the field with jQuery .hide or css.

// This updates the database on profile update to ensure rich_editing is selected ture 
function disable_rich_editing_profile_update() {     
    global $wpdb; 
    $wpdb->query("UPDATE " . $wpdb->prefix . "usermeta SET meta_value = true WHERE meta_key = 'rich_editing'");
add_action('profile_update', 'disable_rich_editing_profile_update', 10, 2); add_action('user_register', 'disable_rich_editing_profile_update', 10, 2);

// Optionally hide the fields as well from the end user
function remove_profile_editor_css() { 
    if (is_admin() { 
        <style type="text/css"> 
            #your-profile > table:nth-child(5) > tbody > tr:nth-child(1) {                 
                display: none; 
add_action( 'admin_head-profile.php', 'remove_profile_css' );
  • Sorry for the bad formatting, I'm using my phone – Bryan Willis Aug 11 '14 at 10:24

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.