Home / admin / Disable Tinymce HTML editor excluding array of users
  • How to Disable Tinymce HTML editor excluding array of users


    Adding this snippet to the functions.php of your wordpress theme will disable tinyMCE for everyone but the specified list of users. This is an updated version of this snippet ( Disable Tinymce ).

    ( example screenshot )

    wordpress snippet : PHP

    add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') );
    add_action( 'admin_head', 'disable_html_editor_wps' );
    function disable_html_editor_wps() {
        global $current_user;
        // change users in list
        $users = array(
        if (!in_array($current_user->user_login, $users)) {
            echo '<style type="text/css">#editor-toolbar #edButtonHTML, #quicktags {display: none;}</style>';

    ( WordPress codex functions, hooks, in this snippet. )

    admin_head, get_currentuserinfo, add_filter, add_action, _e, wp,
  • Mike

    Hi Kevin — your snippets are great, but my needs are many LOL. Ok, is there a simple way to either 1) disable the tinymce editor for a specific post type, 2) disable the text entry area altogether for this post type (I’m using only custom field template boxes for entry)? The latter is what I really need. I know there is and have been Googling for hours when I ran across the above snippet.

    Thanks, Mike

    • http://wpsnipp.com Kevin Chard

      Hi Mike, you can remove the Editor from the custom post type by removing
      that options from the supports array within your custom post type code.

      ‘supports’ => array( ‘title’, ‘editor’, ‘excerpt’, ‘custom-fields’, ‘thumbnail’ ),