How to cloak links in WordPress

by Jeremia on August 25, 2009

If you’re an affiliate marketer, or if you simply promote a few affiliate products via your site and want to cloak your affiliate links – there is an easy-to-use and install link cloaking plugin for WordPress created by W-Shadow.

What the link cloaking plugin does

It allows you to selectively or broadly cloak links that you choose.  It’s not just for affiliate links, you can cloak any links that you choose.  As outlined on the plugin homepage it gives you quite a bit of flexibility and features:

  • Choose what to cloak – all links, only the links you specify or no links at all
  • Choose where to cloak – posts, pages or both
  • Configure the URL – you can set the “prefix” part of the URL (ie “goto” “recommends” etc)
  • Exception list – links pointing to domains in this list will not be cloaked. For example, this is useful if you have chosen to cloak all links but don’t want to cloak the links to your own domains.
  • Compatible with all browsers – the link cloaker plugin doesn’t use JavaScript so it will work even for visitors that have disabled JS.
  • “Smart” cloaking – relative, ambiguous or malformed URLs will not be cloaked. Better safe than sorry.
  • Static link cloaking – You can cloak a link and then use that link anywhere else (other sites, email newsletters, etc.)

I have used this on several projects and it’s extremely easy to install and use.  Simply upload it just as you would any other plugin and activate it.  There are instructions on the plugin homepage that go over how to use it, but you can be up and running in just a few minutes.

A couple important things to note

As I mentioned, I’ve set this up on several different sites and blogs and ran across a couple small bumps:

  • Updating permalinks – You need to go update your permalinks after activating.  You don’t need to change their structure or anything – simply click the update button.
  • Custom fields – It appears that this plugin does not work with custom fields.
  • Template - After messing around with it a bit, I found that you can’t cloak links that are coded into your template.

While I’m sure it could be tweaked or modified to work with custom fields and in templates, right now it currently does not support cloaking via these two places.

You can download the plugin and get more information here: WordPress Link Cloaking Plugin

Related posts:

Leave a Comment

Previous post:

Next post: