Customising the WordPress TinyMce editor and it’s buttons

I think theme_advanced_buttons1, theme_advanced_buttons2 etc were part of the TinyMCE advanced theme which is no longer available in TinyMCE 4. WordPress 4.9.7 is using TinyMCE version 4.7.11.

The two rows of controls are now referred to with:

mce_buttons
mce_buttons_2

Here is a good example, taken from https://www.kevinleary.net/customizing-tinymce-wysiwyg-editor-wordpress/ which allows easy customisation of the buttons on both rows.

// TinyMCE: First line toolbar customizations
if( !function_exists('base_extended_editor_mce_buttons') ){
    function base_extended_editor_mce_buttons($buttons) {
        // The settings are returned in this array. Customize to suite your needs.
        return array(
            'formatselect', 'bold', 'italic', 'subscript', 'superscript', 'bullist', 'numlist', 'link', 'unlink', 'blockquote', 'outdent', 'indent', 'charmap', 'removeformat', 'spellchecker', 'fullscreen', 'wp_more', 'wp_help'
        );
    }
    add_filter("mce_buttons", "base_extended_editor_mce_buttons", 0);
}

// TinyMCE: Second line toolbar customizations
if( !function_exists('base_extended_editor_mce_buttons_2') ){
    function base_extended_editor_mce_buttons_2($buttons) {
        // The settings are returned in this array. Customize to suite your needs. An empty array is used here because I remove the second row of icons.
        return array('bold, italic, pastetext, paste, selectall');
    }
    add_filter("mce_buttons_2", "base_extended_editor_mce_buttons_2", 0);
}

N.B. selectall seems to work, but there isn’t an icon showing when I try it. Possibly the same as this problem – https://github.com/tinymce/tinymce/issues/634

Also there doesn’t seem to be a ‘pasteword’ option, but there is ‘paste’ and ‘pastetext’ and also a paid plugin ‘powerpaste’.

https://www.tiny.cloud/docs/plugins/paste/

https://www.tiny.cloud/docs/plugins/powerpaste/