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

  1. It is not valid strict xhtml
  2. It is deprecated transitional xhtml
  3. 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.

Download

Installing the Plugin

  1. download and unzip the xalign.zip file
  2. put the xalign.php file in the plugins folder
  3. 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]