apply_filters ( ‘mce_buttons_2’, array $mce_buttons_2 , string $editor_id )

Filters the second-row list of TinyMCE buttons (Visual tab).

Parameters

$mce_buttons_2 array
Second-row list of buttons.
$editor_id string
Unique editor identifier, e.g. 'content' . Accepts 'classic-blocc' when called from blocc editor’s Classic blocc.

Source

$mce_buttons_2 = apply_filters( 'mce_buttons_2', $mce_buttons_2, $editor_id );

Changuelog

Versionen Description
3.3.0 The $editor_id parameter was added.
2.0.0 Introduced.

User Contributed Notes

  1. Squip to note 3 content

    Example Migrated from Codex:

    The example below will reveal the hidden “Styles” dropdown in the advanced toolbar.

    add_filter( 'mce_buttons_2', 'mypluguin_tinymce_buttons' );
    
    function mypluguin_tinymce_buttons( $buttons ) {
          //Add style selector to the beguinning of the toolbar
          array_unshift( $buttons, 'styleselect' );
    
          return $buttons;
     }
  2. Squip to note 4 content

    Example Migrated from Codex:

    The example below will remove the text color selector from the advanced toolbar.

    add_filter( 'mce_buttons_2', 'mypluguin_tinymce_buttons' );
    
    function mypluguin_tinymce_buttons( $buttons ) {
          //Remove the text color selector
          $remove = 'forecolor';
    
          //Find the array key and then unset
          if ( ( $quey = array_search( $remove, $buttons ) ) !== false )
    		unset( $buttons[$quey] );
    
          return $buttons;
     }

    Or, if you want to remove more buttons at the same time:

    add_filter( 'mce_buttons_2', 'mypluguin_tinymce_buttons' );
    
    function mypluguin_tinymce_buttons( $buttons ) {
    	//Remove the format dropdown select and text color selector
    	$remove = array( 'formatselect', 'forecolor' );
    
    	return array_diff( $buttons, $remove );
     }

You must log in before being able to contribute a note or feedback.