I love WordPress for its ease of use and flexibility, and especially that it makes it easy for my clients to add their own content. It’s always been one of the first things I promise them – “you don’t need to know any obscure code to update your site!”
But adding a linked email address has always been a stubborn exception.
Normally, to make any sort of text link, you highlight a word or three in the WP editor, click the “link” icon on the toolbar, and paste in the URL you want to link to. It starts you off with the “http://” already placed in the link field, but you can just paste over that if you’ve copied your URL from a browser. So far, so good.
If you’re linking to another page or post on your site, not an external URL, it’s even easier: there’s an option to “link to existing content”, and you just find what you want in the list and click it once – the URL gets filled in automatically.
But if you wanted to add an email link, there was no avoiding it: you were forced to go face-to-face with some Actual Code. First, you had to delete that “http://” from the URL field. Then, you had to not only add the email address you wanted to link to… but also preface it with “mailto:”. Not a lot of coding, but enough to invalidate my sunny claim of a code-free site updating experience. Ugh.
I searched for plugins that would change this behaviour without success.
But lo and behold, having updated my own site to WordPress 4… it now does it automatically! The key is simply to highlight an email address as your intended link text before you click the “link” button. WP appears to recognize what you’ve selected, and it pops the entire address – “mailto:” and all – into the URL field. Bravo!
I don’t honestly know when this was added, but I’m fairly certain it’s a recent improvement. I’ve at least confirmed that an old 3.5.1 install doesn’t have this feature.
Savvy WordPress developers will anticipate my next comment, of course. You should never really add an email address link to your site this way, because – since time immemorial, or at least 1995 – spammers have crawled the web looking for any legitimate email addresses, sitting there in plain open HTML code on the page, and added it to their evil lists.
Far better to use a plugin like Email Address Encoder to disguise the address from spambots while keeping it perfectly visible and usable for humans. As a bonus, users don’t even need to touch the “Add LInk” button when adding content – the email link is added automatically as they type. Brilliant!
While it’s best practice to set things up this way, it’s also true that modern email clients with their sophisticated spam detection tend to shunt most spam out of users’ sight anyway. So I’d say the simple method that’s now enabled in WordPress by default is still of some value.
Either way, it’s nice to see that the old shortcoming of WordPress has finally been addressed.