Customise TinyMCE Buttons

If you, like me, are mostly disabling Gutenberg for all the things, you’re probably also looking to simplify the UI where possible.

I remove a few buttons and type styles from TinyMCE, so the client can only chose from stuff that won’t ruin the design of the site they paid a lot of money for. The only way they can screw it up is by manually fiddling with HTML, and, with the best will in the world, I wouldn’t expect clients to know that, in the same way they wouldn’t expect me to do their job.

This snippet removes stuff like text alignment, font family and size, colour, stuff like that.

/*****
  Remove some editor buttons so client
  can't have the ability to justify text!
*****/
function origin_tinymce_editor_buttons($buttons) {
  return array(
    'formatselect',
    'separator',
    'bold',
    'italic',
    'underline',
    'strikethrough',
    'bullist',
    'numlist',
    'link',
    'unlink',
    'image',
    'blockquote',
    'outdent',
    'indent',
    'undo',
    'redo',
    'removeformat',
    'code'
  );
}
 add_filter('mce_buttons', 'origin_tinymce_editor_buttons', 99);