Force Default Editor Mode

Normally, WordPress will remember which editor mode you were in (Visual or HTML). So if you were using the HTML editor and you save a page, you’ll be returned to the HTML editor.

If you (or your clients) would benefit from always returning to particular mode, you can set that up

add_filter( 'wp_default_editor', 'force_default_editor' );
function force_default_editor() { 
	//allowed: tinymce, html, test
	return 'tinymce';
}

*Functionality is there but quirky in pre-3.3

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;
}

Limit Spellchecker Languages

If you don’t want your spellchecker dropdown to be too big, you can limit the available languages. Cut it down to only a few, or even just one.

add_filter('mce_spellchecker_languages', 'limit_spellchecker_languages');
function limit_spellchecker_languages() {
	//original: +English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv
	return '+English=en';
}

Adding the NextPage Button Back to the Toolbar

There’s a convenient button for the <!--more--> tag on the toolbar, but nothing for the <!--nextpage--> quicktag. Fix that with this

add_filter('mce_buttons','add_nextpage_button');
function add_nextpage_button($buttons) {
    //array_splice so we can insert the new item without overwriting an existing button
    array_splice($buttons, 15,0, 'wp_page' );
    return $buttons;
}

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;
}

Remove Buttons from the Visual Editor

Unnecessary buttons in the Visual Editor? Try this

add_filter('mce_buttons', 'remove_mce_buttons' );
function remove_mce_buttons($buttons) {
	unset($buttons[16]);
	return $buttons;
}
//     [0] => bold
//     [1] => italic
//     [2] => strikethrough
//     [3] => |
//     [4] => bullist
//     [5] => numlist
//     [6] => blockquote
//     [7] => |
//     [8] => justifyleft
//     [9] => justifycenter
//     [10] => justifyright
//     [11] => |
//     [12] => link
//     [13] => unlink
//     [14] => wp_more
//     [15] => |
//     [16] => spellchecker
//     [17] => fullscreen
//     [18] => wp_adv

If you’re concerned about accidentally removing the wrong one, it’s simple enough to add a check

add_filter('mce_buttons', 'remove_mce_buttons' );
function remove_mce_buttons($buttons) {
	if ($buttons[16] == 'spellchecker')
	unset($buttons[16]);
	return $buttons;
}