0

Problem

I'm trying to customise the TinyMCE text editor. Several of the common options for overruling Tiny MCE didn't seem to work for me. So instead I overwrote the functions in my functions file:

function tinymce_editor_buttons($buttons) {
        return array(
                "justifyleft",
                "justifycenter",
                "justifyright",
                "bold",
                "italic", 
                "underline",
                "bullist",
                "numlist",
                "link",
                "hr",
                "undo", 
                "redo", 
                "separator",
                "pastetext",
                "removeformat",
                "formatselect",
                "styleselect",
                );
        }
add_filter("mce_buttons", "tinymce_editor_buttons", 99);

function tinymce_editor_buttons_second_row($buttons) {
   //return an empty array to remove this line
    return array();
}
add_filter("mce_buttons_2", "tinymce_editor_buttons_second_row", 99);

This works great except for the justify functions and separator, which don't appear.

This post lists all the shortcodes, so I think I have the correct codes, and removing and adding other options works, however these two don't.

Why would these options not appear when all the others do?

1 Answer 1

1

Because you are using button references to version 3 of TinyMCE. Beginning in WordPress version 3.9; TinyMCE 4 is being used.

Check this page, then click the "View Source" tab to see the new button names.

Working from your array above:

TinyMCE 3        TinyMCE 4
justifyleft   => alignleft
justifycenter => aligncenter
justifyright  => alignright

As far as I know, the separator button has been removed from WordPress core. I believe they removed the css rules which allowed the separator previously. This WordPress Trac Ticket may explain more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.