Killer hacks to enhance WordPress editor

Posted on Jan 31, 2011

When you're a blogger, the editor is indeed something very important because it is the tool used to write your posts. In this article, I'm going to show you some hacks and tips to enhance WordPress editor. Enjoy!

Allow more HTML tags in the editor

By default, WordPress editor don’t allow html tags wich aren’t compliant with the XHTML 1.0 standard. For example, iframes will be stripped out by the editor. If for some reason you have to insert an iframe into a post or page, this can be very frustrating.

The code below will force the editor to accept more tags. Just paste it into your themefunctions.php file, save it, and you’re done.

Set HTML editor as the default

I know a lot of tech-savvy persons who don’t really like WordPress “visual” editor. Personally, I don’t use it because I’m used to writing HTML, and also because WYSIWYG editors are more likely to produce bad, not valid or dirty code.

If you prefer using the HTML editor, then what about making it your blog default? Just paste the line below into your theme functions.php file, and you’re done.

Add buttons to WordPress editor

TinyMCE (The name of the WYSIWYG editor used by WordPress) have some buttons that allow you to make some text bold, insert paragraphs, and so on. Want to insert a custom button? It’s not so hard at all. The following code show how you can do it easily. Just paste it to your functions.php file and a “Youtube” button will be displayed into your editor. Please note that this code add a button to the editor, but do not trigger any action. If you’d like to get more info about custom buttons, have a look at the source site.

Set different editor stylesheets for different post types

Cutom post types are definitely one of the best new things added to WordPress last year. Now, you probably created some post types to display your portfolio or some code snippets. So, what about using a different stylesheet for your editor, depending on the type of the post you’re currently writing?

Just paste the following code into your functions.php file. You’ll have to adapt it a bit, depending on your post types. Don’t forget to change the stylesheets names as well.