Extending the WordPress editor with TinyMCE modules

In this post I’ll show you how you can easily add additional buttons to the WordPress post editor based on the excellent TinyMCE editor.

As you all may know the default WordPress post editor is based on the TinyMCE WYSIWYG editor. A big advantage in my opinion is that the post editor only contains the really necessary items for formatting text. But sometimes you just want to add something to it.

You can easily do this by adding the following code to your theme’s functions.php.

function enable_more_buttons($buttons) {
	$buttons[] = 'hr';
	return $buttons;
}

add_filter("mce_buttons", "enable_more_buttons");

By doing this I added a button to the post editor which allows you to add a horizontal rule or line in the post’s content. You can add more buttons if you’d like to but I’d keep it as minimal as possible as having too many options is never a good thing and, for instance, could easily confuse clients.

You can add any default TinyMCE button or even an “|” as a separator. If you want to add your own custom button to the editor I suggest you take a look at this page in the WordPress Codex.

Author: Luc De Brouwer

Mild-mannered software engineer, Nine Inch Nails lover, gin drinker, cat person, and somewhat of a geek. Ron Swanson is my spirit animal.

1 thought on “Extending the WordPress editor with TinyMCE modules”

Comments are closed.