3

I'm looking for a way to disable text tab on wordpress text-edito (red square on the pic) for all my users roles except ADMINISTRATOR because i don't want them to have the possibility to add javascript code on the pages. I also looking for a way to add justify icon to the text-editor (like you see on the pic in red too).

now i found a way to hide text tab for all users with the code bellow

    function my_editor_settings($settings) {
    $settings['quicktags'] = false;
    return $settings;
    }

    add_filter('wp_editor_settings', 'my_editor_settings');

How can add an exception for ADMINISTRATOR role?

enter image description here

4

For disabling the text tab for all users except administrators, you can add the following:

function my_editor_settings($settings) {
    if ( ! current_user_can('administrator') ) {
        $settings['quicktags'] = false;
        return $settings;
    } else {
        $settings['quicktags'] = true;
        return $settings;
    }
}

add_filter('wp_editor_settings', 'my_editor_settings');

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.