WordPress linking causes validation problem

12:12 pm in Tools by Paul Left

Inserting a link in WordPress 2.5.1 can cause a validation problem. The problem arises when you insert a link using the Visual editor mode and include a title attribute, generally regarded as highly desirable for reasons of accessibility and promoting your content. The HTML for such a link looks like this:

<a title="Paul Left's blog" href="http://www.verso.co.nz">

W3′s HTML validator doesn’t like this tag: it seem that having the title attribute before the href attribute is invalid code according to the WordPress document type. So the link code should be:

<a href="http://www.verso.co.nz" title="Paul Left's blog">

I click on the HTML tab and go through the code prior to publishing and edit any link tag to ensure the title attribute follows the href attribute. It’s a minor nuisance but there doesn’t appear to be any way to configure WordPress to avoid this. I’m using Firefox and Mac OSX but the same problem happens using Window XP so I assume it’s platform-independent.

The significance of the validation issue is open to heated debate but it does seem desirable to post pages with valid code where possible.