Want to hide the Text Color icon from Visual Editor of WordPress Post Editor from Users other than Admins. How to do it?

  • Hi @Riya - Is this for Classic Editor or Gutenberg? – Louis S Jul 29 '19 at 12:43
  • @LouisS Classic Editor – Riya Jul 30 '19 at 16:04
  • Ok, let me know if my answer below works. – Louis S Jul 30 '19 at 18:16

This should work if you add it to your functions.php file. It targets the buttons on the second row in your text editor. To target the first row, use the mce_buttons hook instead of mce_buttons_2.

 * Removes text color button from tiny mce editor
add_filter( 'mce_buttons_2', 'remove_tiny_mce_buttons');
function remove_tiny_mce_buttons( $buttons ) {
    if ( is_admin() && !current_user_can('administrator')){
    $remove_buttons = array(
        'forecolor', // text color
    foreach ( $buttons as $button_key => $button_value ) {
        if ( in_array( $button_value, $remove_buttons ) ) {
            unset( $buttons[ $button_key ] );

    return $buttons;

If you would like to remove more buttons on the second row (mce_buttons_2), add their IDs to the $remove_buttons array. Below are a few second row IDs:

  • formatselect
  • underline
  • alignjustify
  • forecolor
  • pastetext
  • removeformat
  • charmap
  • outdent
  • indent
  • undo
  • redo
  • wp_help
|improve this answer|||||
  • Thanks it worked – Riya Aug 1 '19 at 14:37
  • Can this code be added to remove other buttons, for e.g: buttons with i class "mce-ico mce-i-et_bloom_shortcode_icon" ? – Riya Aug 1 '19 at 15:36
  • I'm glad that helped. I've edited my answer to explain how to remove more than one button, but I'm not sure if that 'bloom' button is affected by the mce_buttons_2 hook. – Louis S Aug 1 '19 at 20:52
  • So kind of you. Here's the screenshot of the button marked with red arrow ibb.co/fGNq20z and this is the code: <div id="mceu_13" class="mce-widget mce-btn mce-menubtn mce-last" tabindex="-1" aria-labelledby="mceu_13" role="button" aria-label="insert bloom Opt-In" aria-haspopup="true"><button id="mceu_13-open" role="presentation" type="button" tabindex="-1"><i class="mce-ico mce-i-et_bloom_shortcode_icon"></i> <i class="mce-caret"></i></button></div> – Riya Aug 4 '19 at 13:52

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.