code, technology, wordpress

XAlign, A TinyMCE Fix for WordPress

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

Standard