Add more buttons to the WordPress TinyMCE WYSIWYG post editor

WordPress uses the TinyMCE javascript library to power the WYSIWYG post editor. The core team have done a good job of selecting the most commonly needed buttons, but on occasion it can be useful to add more. In my experience, the three most commonly requested buttons are horizontal rule <hr>, superscript <sup> and subscript <sub>.

function tcb_add_tinymce_buttons( $tinyrowthree ) {
  $tinyrowthree[] = 'hr';
  $tinyrowthree[] = 'sub';
  $tinyrowthree[] = 'sup';
  return $tinyrowthree;
}
add_filter( 'mce_buttons_3', 'tcb_add_tinymce_buttons' );

This adds a third row to the editor with your three new buttons. There are more to choose from, you can visit the TinyMCE buttons page to have a look.

You may want to pair this with forcing the kitchen sink always on, so your clients can always find them..

WordPress – Force the Kitchen Sink always on

The two most common questions that our WordPress clients ask us is “where has the colour selector gone?” and “why can I no longer chose which H1 – H6 tag to use?”. The answer is very easy, they need to switch the kitchen sink back on. Sometimes it is easy to forget that there’s a whole world of people out there who just don’t care about things like CMS or WordPress let alone The WYSIWYG content editor. And rightly too.

The answer was to add a short filter to the theme (or plugin) that forces the kitchen sink to always be on. Then there is no confusion.

/**
 * Force the kitchen sink to always be on
 */
add_filter( 'tiny_mce_before_init', 'tcb_force_kitchensink_open' );
function tcb_force_kitchensink_open( $args ) {
  $args['wordpress_adv_hidden'] = false;
  return $args;
}

[UPDATE 2013-04-02]
I have updated this to use WordPress TinyMCE filters. The old way would not work with more recent versions of WordPress (which is probably a good thing).