WordPress Tutorial: Custom Advanced Block Formats

WordPress has a great admin user interface complimented by the TinyMCE wysiwyg editor but there are times when the default setup of TinyMCE doesn't give you the flexibility you desire. Maybe you want editors to add some code samples, or wrap a portion of text in an address tag.

Using the following code snippet you can customize the output of the TinyMCE block format drop down list. Simply copy the code to your functions.php.

function fb_change_mce_buttons( $initArray ) {
//@see http://tinymce.moxiecode.com/wiki.php/Configuration:theme_advanced_blockformats
$initArray['theme_advanced_blockformats'] = 'h1,h2,h3,h4,h5,h6,p,div,blockquote,code,samp,address,dt,dd';
$initArray['theme_advanced_disable'] = 'forecolor';
return $initArray;
add_filter('tiny_mce_before_init', 'fb_change_mce_buttons');

This is a great way to tailor the TinyMCE experience to your editors requirements.