Link Cloaking Plugin for WordPress

This is a plugin for WordPress that can automatically cloak outgoing links in your posts and/or pages.

Download plugin
(Note: May not be compatible with the latest version of Eclipse Link Cloaker.)

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.
  • 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.
  • If desired, you can also add your own cloaked links manually.

Examples

Lets say you’ve got a link you want to be cloaked.

<a href="http://example.com/?affiliate=me">Cloak Me</a>

Once you install the plugin, it will automatically, without requiring any configuration, turn it into a cloaked link when it’s displayed to a visitor:

<a href="http://yoursite.com/goto/Cloak_Me/12/34">Cloak Me</a>

Here’s a live example: Cloak Me

As an alternative to the fully automatic cloaking, you can switch the plugin to “selective cloaking” and tag the links you want to cloak manually:

<a href="http://example.com/?affiliate=me">Cloak Me<!--cloak--></a>

Note: The plugin does not actually edit your posts or permanently modify your links. Instead, it switches them on-the-fly whenever someone views them on your site. When editing a post in the admin panel, you will see the original, uncloaked link.

Download

Version 1.8.4 : link-cloaking-plugin.zip (16 KB)

Requirements :

  • WordPress 2.8 – 3.3
  • mod_rewrite. If “pretty permalinks” work on your blog then you probably have this already.

(Note: May not be compatible with the latest version of Eclipse Link Cloaker.)

Installation

  1. Download the link-cloaking-plugin.zip file.
  2. Unzip the file.
  3. Upload the `link-cloaking-plugin` folder to the `/wp-content/plugins/` directory.
  4. Activate the plugin through the ‘Plugins’ menu in WordPress.
  5. (Optional) Go to Settings -> Link Cloaking and modify the default settings to your liking.

FAQ

Why are some of my links not getting cloaked?

The most common possibilities are:

  • Links in the sidebar, header, comment area and so on can’t be cloaked by the free version of the plugin. It only works on links in page/post body. Upgrade to the premium version to cloak links anywhere on the page.
  • Links added using other plugins, theme features or custom fields are also supported only in the premium version.
  • JavaScript links, as well as Flash and context-sensitive ads are not supported by any version of this plugin.

Why are none of my links getting cloaked?

  • If using “Seletive cloaking”, make sure you have actually marked some links with the <!--cloak--> tag.
  • Double-check that the links in question aren’t added or modified by plugins, the theme, or custom fields.
  • Contact me. You might have found a bug.

The exception list doesn’t seem to work. What could be the problem?

Make sure to enter only domain names in the “Exceptions” box. For example, given a link like “http://example.com/directory/page.html”, the domain name is the “example.com” part. So to prevent the plugin from cloaking that link, add “example.com” (sans quotes) to the “Exceptions” box. Entering the full URL or “http://example.com/” will not work.

Additionally, if some of your links point to example.com and some to www.example.com, you will need to add both of those to the exceptions.

Why do some cloaked links redirect me back to my homepage?

Most likely, your post(s) contain links created or modified by other plugins, the theme, or custom fields. Either remove those links, or upgrade to the premium version.

Why do some cloaked links redirect me back to my homepage?

See the previous question.

Why do cloaked links display a “Not Found” error?

  • Make sure you’re using pretty permalinks.
  • Your .htaccess might be out of date. To update it, go to Settings -> Permalinks and click “Save Changes”.
  • Your hosting company may be blocking browser access to PHP files in the /wp-content/plugins/ directory, usually as a security measure. The free version of the plugin is not compatible with these hosts. Consider using the premium version instead.

I have a question not addressed in this FAQ. What should I do?

Either leave a comment below, or email me directly. My email address can be found on the contact page.

Related posts :

802 Responses to “Link Cloaking Plugin for WordPress”

  1. Your Netbook says:

    I’ve been using this plugin for a while now and it’s always worked well.

    This week I had to re-install my site due to a plugin crash (not yours) and when I re-installed the Link Cloaker all my links started to go to my most recent post and not to the merchants page.

    I have had to de-activate the plugin now so as not to lose sales but do you have any idea what has gone wrong?

    Phil…

  2. White Shadow says:

    You probably need to update your .htaccess with the cloaker’s rules. To do that, go to Settings -> Permalinks and click “Save Changes”.

    If that doesn’t help, open the .htaccess and make sure the plugin’s code is at the top of the file. It’s the part that begins with “# Link Cloaker Plugin BEGIN” and ends with “# Link Cloaker Plugin ENDS”.

  3. Your Netbook says:

    The first suggestion worked perfectly. It’s something that I know I should have thought about but you tend to panic and think it’s something else though.

    Thanks for your help.

    Phil…

  4. 3dogs says:

    Does this problem have issues with sub-domains in urls (other than www)? Everything is working perfectly except for some rover.ebay.com urls. I’ve put echo’s and var_dumps in strategic places within the script to see what goes where, and the rover.ebay.com urls never even get to the rewrite_link function. Could this be a regex issue (which is like a foreign tongue to me)?

  5. 3dogs says:

    Boy, I fat -fingered (or perhaps fat-brained) that post. Change “Does this problem” to “does this plugin”.

  6. White Shadow says:

    I don’t think sub-domains are the problem here – in fact, a link pointing to “http://rover.ebay.com/” gets cloaked just fine on my test site.

    Could you post the full HTML for one of the problematic links (i.e. the entire “<a href= …. </a>” code) so I can test it myself?

  7. Michael says:

    Hi J – ,

    Editing this behind a password…I have Ad boxes for my affiliate marketing. Pulling my hair out trying to get this to work. Here is a live demo of the WP Theme I’m using: http://www.gabfirethemes.com/demos/blognews/.

    I have ads placed in the header, footer, the right sidebar (iTunes one) and the top Ad Spot 125×125 box so far. None are cloaked although I’ve got the Plugin installed.

    Do I need to design a widget for this to work? I’ve tried to use the cloaked URL in the code that I need to upload, but that doesn’t work.

    Do I need to go “static” or use in the affiliate code?

    thanks for your help.

    Michael

  8. Michael says:

    The last sentence should read….

    Do I need to go “static” or use “” in the affiliate code?

    I didn’t put quotes around “cloak” and it disappeared!

  9. White Shadow says:

    In this case you should use the so-called “static” links which can be defined in Tools -> Cloaked Links. Enter your normal affiliate URLs in that tab and then click on “show cloaked url” to get a cloaked URL for each link. Then use those cloaked URLs in your ads.

  10. rogersnz says:

    Hi

    I have been using your plugin for some time and it works really well in posts and pages.
    However I need to create a cloaked link in the sidebar. I have created a static link under Tools/Cloaked Links. However I am not sure exactly where or what to put it in my code in the sidebar.
    Have looked on this site for some examples but haven’t seen any so far.
    Can you please provide a couple of examples? That would be really great.

    Thanks, Roger

  11. White Shadow says:

    Just use the cloaked URL (the one you see when you click “show cloaked url” on that page) in the same way as you would use the original affilate link. There is nothing more to it.

  12. Michael says:

    Static Cloak did not solve the issue I’m having. I know it is not the plugin though. Trying to cloak some Amazon Affiliate html code, for example the hypothetical below. This is the entire html code.

    Tried cloaking the following:

    http://rcm.amazon.com/e/cm?t=gigfy-04&o=1&p=26&l=ur1&category=kindle&banner=8675309ad=ifr

    with and without the question marks and several other variations.

    To make things more challenging, when you do a “mouse-hover” the redirect shows “http://www.amazon.com/andsfkadskfa;sldkjfaksjdf;kajsdf” which I’ve also tried to cloak.

    Do I need to create a subdomain or subdirectory for this? I’ve tried a simple .php script where it went something like:

    mydomain/index.php?title=new page name

    where “new page name” ‘cloaked’ the above html code from Amazon.

  13. White Shadow says:

    I’m afraid I don’t quite understand what you’re trying to say. This may be because some HTML code was automatically stripped from your comment. If you want to post code, try surrounding it with <pre></pre>

    Did you try to cloak an entire HTML code block using this plugin? That would not work; the plugin isn’t designed for that. It only cloaks links, or – more specifically – URLs. It doesn’t deal with link titles, HTML code, JavaScript, Iframes or anything else like that.

    If the hypothetical HTML code contains an URL, you could take that URL, make a cloaked version of it, and modify the HTML to use the cloaked URL instead.

  14. Tor Gunnar says:

    Will you at a later time update the plugin so it will work inside your template aswell?

    That will be awsome and im sure your donate button will get 100% more used 😉

  15. White Shadow says:

    I’ve thought about it, but it would be very tricky to do and probably cause conflicts with some other plugins like WP-SuperCache. Perhaps someday 🙂

  16. Rick,

    All the way from http://www.internetmarketingforums.net.

    This is great information. You have a knack.

    Just a shout out and will give it a tweet too!

    mike

  17. tomron says:

    i dowloaded your plugin sometime ago and im using it all the time. its great so far so thanks a lot for it…now here comes the question:there is a simple tracking implemented in this plugin, it shows you how many times cloaked link have been clicked.unfortunately it shows you overall number of clicks for a link…what if i want to see how many clicks were made daily?so lets say i have these 50 links, i would like to see some kind of general DAILY summary how many times links have been clicked.i know it may be too much to implement it in the plugin but maybe you have some idea how to track it using some analytics or other tracking plugin…i was trying to figured it out but wasnt luck yet…any ideas would be much appriciated!
    so how do you daily track your cloaked links?anyone happy to help?

Leave a Reply