Restore Image Title – A WordPress Plugin

Well DoneNow that I’ve tweaked that little plugin I wrote so that it not only works, but shouldn’t actually break anything, I’ve submitted it to the WordPress Plugin Directory so that anyone who needs it can install it on their own sites without actually having to copy and paste code from a web page.

If you haven’t read my earlier mutterings, this came about because of a change in WordPress 3.5. From this version onwards, when you insert an image into a post, the <img > tag that’s generated doesn’t contain the title attribute. This was done for reasons connected with accessibility, which sounds reasonable enough, but it does cause some borkage. The first thing is that you won’t get tooltips when hovering over images – this isn’t a big deal, but can you imagine xkcd without the ubiquitous extra text? The other thing that breaks is a lot of lightbox plugins – I use one of these, and like most of the species, it relies on the title of the image for its caption.

So, I spent a bit of time working out how to get the title back without having to edit every image after inserting it, and after a bit of research[1], I found a quick and simple method of doing it. Following some helpful advice on the WordPress forums, I tweaked it a bit to prevent breakage, and it’s now ready and waiting for anyone who wants it.

Here’s the link:

Restore Image Title

[1] As i may have pointed out once or twice, coding does not come naturally to me…