Following Weston Ruter's post here: https://make.wordpress.org/core/2017/05/23/addition-of-tinymce-to-the-text-widget/

I came up with this:

(function($) {
    $(document).on('tinymce-editor-setup', function(event, editor) {
        if (editor.settings.toolbar1 && -1 === editor.settings.toolbar1.indexOf('alignleft', 'aligncenter', 'alignright', 'blockquote')) {
            editor.settings.toolbar1 += ',alignleft ,aligncenter, alignright, blockquote ';               

       //  editor.settings.toolbar1 -= 'numlist';


I am very weak in javascript. This is causing some weird behavior. At first, I got a nicely formatted toolbar. But now it seems to have some kind of override if you have too many toolbar buttons, and I ended up with this:

"Advanced" text widget bar

All I wanted to do, is add those buttons in the code above, and remove the "numlist" button, so I have just one toolbar bar.

1) How do I remove buttons using javascript?

2) Why is it sometimes going into this "advanced" mode, and sometimes just placing the button on the second toolbar line? Is this a bug?

2 Toolbars (no extra "advanced" mode)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.