Trying to figure out how to hide TinyMCE Controls (forcolor mainly) in WordPress 3.9 beta 2.

The code that was working in 3.8.1 was

 $init['theme_advanced_disable'] = 'forecolor';

but theme_advanced_disable no longer seems to work. I can define the whole bar with

 $init['toolbar1'] = '...';'

but all I really need to do is hide a few options. I feel like I'm just missing the new name... can anyone point me in the right direction?


I'm not sure if there is an official way to do this in TinyMCE 4.0 or not, I can't find any references in their docs or on WordPress - below is a PHP method you could use to do this:

function myformatTinyMCE($in)
    $del_buttons = array('bold', 'italic', 'strikethrough');
    $temp = explode(',', $in['toolbar1']);

    foreach($del_buttons as $del){
        if(($key = array_search($del, $temp)) !== false){
    $temp = array_values($temp);

    $in['toolbar1'] = implode(',', $temp);
    return $in; 
add_filter('tiny_mce_before_init', 'myformatTinyMCE', 10);
  1. Split Toolbar String into an Array
  2. Loop through our Delete array, if the value is in Temp, set the key
  3. Unset our button from our temp array
  4. Fix our values
  5. Convert it back to a string and set it back to Toolbar1

You can filter the various toolbars in TMCE4, as you could in TMCE3.

function my_mce_buttons_2( $buttons ) {
    if(in_array('forecolor', $buttons)) {
        $buttons = array_diff($buttons, array('forecolor'));
    return $buttons;

add_filter('mce_buttons_2', 'my_mce_buttons_2');

Your Answer

