Word Fix Plugin
Friday, January 26th, 2007I am proud to announce the arrival of my second wordpress plugin! My first was a translate widget, which was very popular, but this one is of a different family. As users of Wordpress may know, a nice WYSIWYG (What You See Is What You Get) editor is now included for writing posts. A frustration I ran into when working on a project was that when pasting text from Microsoft Word, or an email, junky formatting from there often carried over, sometimes surprising readers with out-of-place fonts and colours. I personally write all my posts in the editor, but in this case, the users of Wordpress needed to be copying out of Word and emails. The solution? Write a plugin to clean up the mess, of course.
Word Fix will remove all the peculiar fonts, colours and other styles which may appear after copying text from other applications. It saves you the hassle of cleaning up the direct HTML code, which is especially handy if you or your users dont’ have the knowledge or time to dive into the code.
Installation: This is a bit tricky, because the plugin is actually for TinyMCE, the visual editor software, not Wordpress itself.
- Download the plugin for your version of Wordpress (2.0, or 2.1).
- Unzip it, and upload the “wordfix” folder into your “wp-includes/js/tinymce/plugins/” directory.
- Now, you need to modify a file. For Wordpress 2.0, switch your “wp-includes/js/tinymce/tiny_mce_gzip.php” file with this one. For Wordpress 2.1, switch your “/wp-includes/js/tinymce/tiny_mce_config.php” file with this one. All I’ve modified is adding the wordfix plugin to the list of loaded plugins, and the visible buttons on the editor.
Now when you go to write or edit a post, you should see the Word Fix button at the end of your toolbar:
. Simply click it, and the text in your editor pane will be cleaned up! It’ll take just a second, and you’ll see the text flash a bit when it’s complete. If for some reason it messed something up, just hit Control-Z to undo it. Save your post when the changes are finished, and your formatting should look the way it was meant to! I recommend you run this as soon as you copy in the text, and then proceed to make any other formatting changes after.
To uninstall the plugin, remove the two instances to ‘wordfix’ in either the tiny_mce_gzip.php (2.0) or tiny_mce_config.php (2.1) file. Then you can remove the wordfix folder in “wp-includes/js/tinymce/plugins/”.
If you want the details of what this plugin does exactly to your text, read on. Otherwise, go enjoy your nice clean formatting! First, all the html tags except for these are removed: (<a><img><p><u><b><i><strong><em><ul><li><ol><br><strike><code><abbr><!–more–>). Then, all class, id, and style attributes are removed from all tags. Then, all <b> and <i> tags are changed to <strong> and <em>, to match Wordpress standards. Combined, these steps eliminate all the formatting headaches I have encountered.
Icon based on the Silk Icons.

