8

I have this nice little function to remove buttons from the tinyMCE editor in WordPress, so far I've been able to remove most of the ones I need to.

function custom_disable_mce_buttons( $opt ) {
    $opt['theme_advanced_disable'] = 'justifyfull,forecolor,removeformat,justifycenter,justifyright,justifyleft,charmap,indent,outdent,undo, redo';
    return $opt;
}
add_filter('tiny_mce_before_init', 'custom_disable_mce_buttons');   

The button control list can be found here: http://www.tinymce.com/wiki.php/TinyMCE3x:Buttons/controls

The problem is, there's a few more ones I'd like to remove, like the spellchecker and the 'insert more tag', but I can't find documentation anywhere of the codes/names for these buttons to remove them.

Any got any info on this?

3 Answers 3

4

wp_more - insert more button,

spellchecker - spellchecker button

I've tried it with your code on WP 3.5.1 and it worked fine for me.

3
  • Perfect, thanks. Can you direct me towards any documentation of this or where you found it?
    – andy
    Jun 18, 2013 at 13:57
  • Well, I checked it in WP sources :) Jun 18, 2013 at 16:15
  • You can also know the names by inspecting the button and checking the class. If you have mce-i-spellchecker the button name is spellchecker. May 14, 2015 at 22:30
6

You can try to remove the Spellchecker and the Insert More Tag buttons by adding:

spellchecker, wp_more

to your $opt['theme_advanced_disable'] comma-seperated string.

On my install I have these options:

[theme_advanced_buttons1] => bold,italic,strikethrough,bullist,numlist,blockquote,justifyleft,justifycenter,justifyright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv,separator

[theme_advanced_buttons2] => formatselect,underline,justifyfull,forecolor,pastetext,pasteword,removeformat,charmap,outdent,indent,undo,redo,wp_help

Here is the list:

bold,
italic,
strikethrough,
bullist,
numlist,
blockquote,
justifyleft,
justifycenter,
justifyright,
link,
unlink,
wp_more,
spellchecker,
wp_fullscreen,
wp_adv,
separator,

and

formatselect,
underline,
justifyfull,
forecolor,
pastetext,
pasteword,
removeformat,
charmap,
outdent,
indent,
undo,
redo,
wp_help
2
  • 1
    Note: justifyleft, justifycenter, justifyright changed to alignleft, aligncenter, alignright
    – Sisir
    Jun 26, 2015 at 11:21
  • Thanks for the update and feel free to update the answer if you see some outdated info @Sisir
    – birgire
    Jun 26, 2015 at 11:31
5
add_filter("mce_buttons", "tinymce_editor_buttons", 99); //targets the first line
add_filter("mce_buttons_2", "tinymce_editor_buttons_second_row", 99); //targets the second line

function tinymce_editor_buttons($buttons) {
return array(
    "undo", 
    "redo", 
    "separator",
    "bold", 
    "italic", 
    "underline", 
    "strikethrough", 
    //"separator",
    //"bullist", 
    //"separator",
    //add more here...
    );
}

function tinymce_editor_buttons_second_row($buttons) {
   //return an empty array to remove this line
    return array();
}

Result:

enter image description here

4
  • Thanks for this. I am trying to show the code button. I tried code-sample and code. Oct 31, 2019 at 11:53
  • 1
    @AndrewTruckle you're welcome. Hope you got it to work.
    – Adam
    Nov 1, 2019 at 14:32
  • Hi. At the moment I can’t get code button to show. Tried code, sample-code. Next I will try code-sample but I have to check on pc. The tablet shows restricted buttons it seems. Nov 1, 2019 at 17:33
  • In the end I sorted it by installing the TinyMCE Advanced plugin. Nov 1, 2019 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.