Add Font-Select Drop Down to Visual Editor

Add the font-select menu to the 2nd row of buttons (revealed with the Kitchen Sink button)

If some items aren’t removed from the second row, the buttons won’t fit nicely on a 1024×768 screen.

See WordPress’s default buttons in wp_tiny_mce()

add_filter('mce_buttons_2', 'add_fontselect_row_2' );

function add_fontselect_row_2( $mce_buttons ) {
        find the keys of the buttons to be sacrificed
    $pastetext = array_search( 'pastetext', $mce_buttons );
    $pasteword = array_search( 'pasteword', $mce_buttons );
    $removeformat = array_search( 'removeformat', $mce_buttons );

    unset( $mce_buttons[ $pastetext ] );
    unset( $mce_buttons[ $pasteword ] );
    unset( $mce_buttons[ $removeformat ] );

        insert the new dropdown where the sacrificed buttons used to be
        alter as needed
    array_splice( $mce_buttons, $pastetext, 0, 'fontselect' );
    return $mce_buttons;

But if you’re adding the 3rd row, you’re probably clear (unless you have other plugins that are adding buttons).

add_filter('mce_buttons_3', 'add_fontselect_row_3' );

function add_fontselect_row_3( $mce_buttons ) {
    $mce_buttons[] = 'fontselect';
    return $mce_buttons;

Currently, any buttons added to the 3rd or 4th rows will always be visible (Kitchen Sink only shows/hides the 2nd row) – but a patch has been submitted to correct this, hopefully it’ll be committed.

However, if you’ll probably want to clean up the font options – remove fonts that you’ll never use (or should never be used).

add_filter('tiny_mce_before_init', 'restrict_font_choices' );
function restrict_font_choices( $initArray ) {
    $initArray['theme_advanced_fonts'] = 
        'Andale Mono=andale mono,times;'.
        //'Arial Black=arial black,avant garde;'.
        'Book Antiqua=book antiqua,palatino;'.
        //'Comic Sans MS=comic sans ms,sans-serif;'.
        'Courier New=courier new,courier;'.
        'Times New Roman=times new roman,times;'.
        'Trebuchet MS=trebuchet ms,geneva;'.
        //'Wingdings=wingdings,zapf dingbats'.
    return $initArray;

Allow Non-Standard Tags in the Editor

If you find yourself needing to add non-standard tags to the WordPress editor, you may also find yourself feeling very frustrated. With just a little bit of code, you can tell the editor to accept extra tags

add_filter( 'tiny_mce_before_init', 'mce_extended_valid_elements', 10, 2);
function mce_extended_valid_elements( $mceInit, $editor_id ) {
	//allow only the basic tag
	//$mceInit['extended_valid_elements'] .= ',sometag';
	//allow the tag and a attribute
	$mceInit['extended_valid_elements'] .= ',sometag[someattribute]';
	//allow the tag and multiple attribute
	//$mceInit['extended_valid_elements'] .= ',sometag[someattribute|anotherattribute]';
	//allow the tag and any attribute
	//$mceInit['extended_valid_elements'] .= ',sometag[*]';
	return $mceInit;

Change Block Format Dropdown in the Visual Editor

Have clients that insist on using <h1> tags throughout their posts? Can’t remember the last time you used the <address> tag? This can help you clean up that block format dropdown menu.

add_filter('tiny_mce_before_init', 'change_mce_dropdown' );
function change_mce_dropdown( $initArray ) {
	$initArray['theme_advanced_blockformats'] = 'p,h3,h4,h5,h6,pre';
	return $initArray;