How to Remove TinyMCE Buttons from WordPress Editor?

Categories WordPress TutorialsTags , , Start discussion

TinyMCE editor makes it easy for you to create content without typing HTML tags manually. It comes with lots of buttons by default to make it handy for you. Some WordPress plugins add extra buttons in TinyMCE editor also. However sometimes you might need to remove TinyMCE buttons, one or more.

Why Need to Remove TinyMCE Buttons?

First, look at the buttons in TinyMCE editor. There are 26 buttons in all, organized in two-row. Among them, 24 buttons comes with WordPress install and other two (right-sided two) buttons implemented by plugins. You might have more buttons, it depends on which plugins you are using!

TinyMCE editor | Remove TinyMCE buttons

In most cases, you don’t need all those buttons. Depending on the level of customization or user satisfaction, you may need to remove some of these buttons. Sometimes removing buttons can secure your site by hiding vulnerable plugins buttons from other users.

Remove TinyMCE Buttons

To remove tinymce buttons, first you need to know the button name. Here are all default buttons name –

bold, italic, bullist, numlist, blockquote, underline, alignjustify, alignleft, aligncenter, alignright, link, unlink, strikethrough, wp_more, spellchecker, wp_adv, dfw, formatselect, hr, forecolor, pastetext, removeformat, charmap, outdent, indent, undo, redo, wp_help

Here wp_more is for read-more button, wp_adv for toggle-row, dfw for distraction-free-writing-mode, formatselect for dropdown-menu, hr for horizontal-line, forecolor for text-color, removeformat for clear-formatting, charmap for special-characters and wp_help for keyboard-shortcuts.

To find the name of plugins implemented buttons, open page source of the editor page from right-click browser options. Now, find the term tinymce.PluginManager.load in page source. You will find something like this if you have any plugin implemented button.

tinymce.PluginManager.load("AtD", "");

You might find more results if you have more buttons. In the result, AtD is the button name which implemented by Jetpack plugin. After collecting all buttons name, you can now remove any button you desires.

To remove tinymce buttons from first row you need to use mce_buttons filter-

// Remove unwanted TinyMCE buttons from first row
function sm_remove_button_tinymce_first_row( $buttons ) {
    $remove = array('spellchecker', 'AtD', 'wp_more');
    return array_diff( $buttons, $remove );
add_filter('mce_buttons', 'sm_remove_button_tinymce_first_row', 2000);

This function will delete spellcheker, AtD and wp_more buttons from tinymce editor first row. You can add more name inside array if you want, you can also remove just one!

To remove tinymce buttons from second row you need to use mce_buttons_2 filter-

// Remove unwanted TinyMCE buttons from second row
function sm_remove_button_tinymce_second_row( $buttons ) {
    $remove = array('charmap', 'removeformat', 'wp_help');
    return array_diff( $buttons, $remove );
add_filter('mce_buttons_2', 'sm_remove_button_tinymce_second_row', 2020);

This function will delete charmap, removeformat and wp_help buttons from tinymce editor second row.

You can add those functions in themes functions.php, your own plugin or Functionality plugin. We recommend to use the functions in functionality plugin. That’s all. We think this article will help you.

If you need further help, please comment.

Leave a Reply

Your email address will not be published.