Sometimes you want to customize the look and feel of WordPress.
There are many ways to remove some buttons from the WordPress richtext editor (TinyMCE).
You can target the button with CSS and hide it OR you can remove the button by using a WordPress filter for that.
Either way can work depending on how much time you current have.
To target the elements we need to hook into mce_buttons and mce_external_plugins WordPress filters.
The function that we register will receive the data in this format:
array ( 0 => 'formatselect', 1 => 'bold', 2 => 'italic', 3 => 'underline', 4 => 'forecolor', 5 => 'bullist', 6 => 'numlist', 7 => 'blockquote', 8 => 'alignleft', 9 => 'aligncenter', 10 => 'alignright', 11 => 'alignfull', 12 => 'wp_adv', 13 => 'some_plugin_name', 14 => 'another_plugin_name', 99 => 'orbisius_child_theme_creator', );
To remove the buttons you don't need you can use this code. Make sure you replace "some-plugin" text with the ID that you'd like to remove.
/** * Add this to a custom plugin of yours or functions.php of the current theme. * author: Slavi Marinov | https://orbisius.com * Post link: https://orbisius.com/p4240 */ add_filter( 'mce_buttons', 'orbisius_custom_fix_remove_tinymce_buttons' ); add_filter( 'mce_external_plugins', 'orbisius_custom_fix_remove_tinymce_buttons' ); /** * rm some tinymce buttons. * @param array $buttons * @return array */ function orbisius_custom_fix_remove_tinymce_buttons( $buttons ) { foreach ($buttons as $idx => $id ) { if (stripos($id, 'some-plugin') !== false) { unset($buttons[$idx]); } } return $buttons; } ///////////////////////////////////////////////////
Disclaimer: The content in this post is for educational purposes only. Always remember to take a backup before doing any of the suggested steps just to be on the safe side.
Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer