Change WordPress user roles and capabilities › Forums › How to or FAQ › How to disable the Text Editor? – just Visuell Editor should be displayed › Reply To: How to disable the Text Editor? – just Visuell Editor should be displayed
05/09/2016 at 06:35
#2711
Vladimir
Keymaster
If you wish to have more control it’s possible to integrate this code snippet with User Role Editor as the additional options for role:
add_filter('ure_role_additional_options', 'add_visual_editor_only_option', 10, 1);
function add_visual_editor_only_option() {
$item = URE_Role_Additional_Options::create_item('visual_editor_only', esc_html__('Visual Editor Only', 'user-role-editor'), 'admin_init', 'ure_remove_text_editor');
$items[$item->id] = $item;
return $items;
}
function ure_remove_text_editor() {
add_filter('wp_editor_settings', 'ure_editor_settings');
add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') );
}
function ure_editor_settings($settings) {
if (!current_user_can('administrator')) {
$settings['quicktags'] = false;
}
return $settings;
}