XAlign: remove the align attribute from WordPress posts
It’s bothered me that TinyMCE, WordPress’ default rich text editor, uses the align attribute. For example if you want to center some text and use TinyMCE you’ll get code that looks like this:
<p align=”center”>My centered text</p>
Why is that a problem? Here’s the list
- It is not valid strict xhtml
- It is deprecated transitional xhtml
- It does not function as expected across browsers in all cases
Anyone writing new code should aim to have valid strict xhtml. Why? Because strict code will offer a better experience for everyone across browsers, it will be easier to update, and it is more future-proof (though nothing is 100% future proof). Hopefully WordPress will come up with a built-in solution soon and render this plugin pointless, but until then this works.
Installing the Plugin
- download and unzip the xalign.zip file
- put the xalign.php file in the plugins folder
- activate the plugin
Using the Plugin
- XAlign works automatically, you don’t need to do anything but activate the plugin.
[tags]wordpress plugin, xhtml, strict xhtml, remove align attribute, tinymce, wordpress, align attribute[/tags]