Question

In last version of TinyMCE there was simply code to hide buttons in visual editor (Remove Specific Buttons from WP Editor TinyMCE). But with WordPress 3.9 TinyMCE 4.0 have other API.

Someone know how to do it now?

Was it helpful?

Solution 2

function delete_button($buttons) {  
   unset($buttons[6]);
   unset($buttons[7]);
   unset($buttons[8]);
   unset($buttons[9]);
   unset($buttons[12]);
   unset($buttons[14]);
   return $buttons;
}

add_filter('mce_buttons', 'delete_button');

print_r($buttons) to read specific buttons numbers.

OTHER TIPS

If I understood the question correctly, you can use something like this to remove the default buttons from the WP tinyMCE.

// Remove TinyMCE Default Button

function myplugin_tinymce_buttons( $buttons ) {
      //Remove the text color selector
      $remove = 'blockquote'; //default blockquote button

      //Find the array key and then unset
      if ( ( $key = array_search( $remove, $buttons ) ) !== false )
        unset( $buttons[$key] );

      return $buttons;
 }
add_filter( 'mce_buttons', 'myplugin_tinymce_buttons' );

to know what is the name of the element you need to use your browser dev tools. Simply highlight the element and see the class. It will be also the name. For example: where to see the name of the element

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top