Hide TinyMCE controls in TinyMCE 4 (WordPress 3.9)

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){
            unset($temp[$key]);
        }
    }
    $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