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 ).

 

 

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;
get_currentuserinfo();
// change users in list
$users = array(
"dave",
"larry",
"steve",
"ryan"
);
if (!in_array($current_user->user_login, $users)) {
echo '<style type="text/css">#editor-toolbar #edButtonHTML, #quicktags {display: none;}</style>';
}
}

Be Sociable, Share!

Leave a comment