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. […] I’ve created a plugin for WordPress that can cloak links in your blog posts and pages. Read more and download the plugin here. […]

  2. wesley says:

    You mean link masking. I was thinking you had a search engine cloaking thingie going (showing different content or links to search engines)

    Thanks

  3. White Shadow says:

    On internet marketing forums and similar sites this is often referred to as “cloaking” so I used that term here. There’s a whole bunch of related techniques, call them what you like – cloaking, masking, obfuscation.

    I’ve heard about search engine cloaking but I haven’t really investigated that topic.

  4. HiTech says:

    Thanks for the plugin, i think it will work well on my blog for affiliate links 😉

  5. Ramil says:

    Thanks for the plugin. Is it possible to cloak links in the sidebar, for example I put an affiliate link in the blogroll?

  6. White Shadow says:

    Ramil – no, not yet. I’ll think about adding that feature. I’m not sure it’s possible/easy to do though because on most WordPress blogs the sidebar is handled by “widgets” which could be a problem.

    If you have the link in question in a post you can copy & paste the cloaked link to the sidebar and it should work unless you add/remove links to the post with that link.

  7. Thank you for an excellent plugin and for making my life easier!

    Jai

  8. HiTech says:

    How can i get rid of the numbers at the end of the cloaked link? The post id and link id?

  9. White Shadow says:

    HiTech,

    In this version you can’t get rid of them. They’re what allows me to keep the plugin simple and relatively fast.

    To be able to ommit the numbers I’d have to either encode all of the original URL in the cloaked link (leading to long links with weird characters in them) or store the links in a database (meaning you’d need to set up every cloaked link manually). I’ll think about adding the second feature in a future version.

  10. Dolly says:

    Most affiliate links will not work becuase they are relative, ambiguous or malformed URLs

  11. White Shadow says:

    Huh? That is simply not true.

    Most affiliate links are not relative, as they point to a different site. They’re most likely unambiguous for the same reason. Malformed URLs probably wouldn’t work in most browsers, so if your links work, it’s likely they are well-formed.

    From software perspective, affiliate links are no different from “ordinary” links.

  12. […] cloaking in wordpress I found a goos WordPress plugin for cloaking links here : Link Cloaking Plugin for WordPress | W-Shadow.com. It works great for me ! […]

  13. Dolly says:

    Sorry,
    i thought they were not working because of all the characters but I missed a step in my installation
    it actually works great

  14. White Shadow says:

    That’s okay, it’s good that you got it sorted out 🙂

  15. […] time ago I created a WordPress plugin that can cloak affiliate links automatically. Today I’m releasing a new version, with all-new […]

  16. TC says:

    I just came across this and am playing with it, I love what I see so far, thank you :). There is one thing that I’d like to do, for affiliate links it’s a good idea to tag &afsrc=1 at the end of a cloaked link (to protect your commissions from being stolen from parasites and spyware).

    I’m sure I could add that somewhere in the plugin files so that every link I cloak automatically gets that appended to the cloaked link. I just don’t have a clue how to do that though. Could you advise?

  17. TC says:

    Just to clarify, when the &afsrc=1 is on the cloaked link, I mean that the link will be like this (using your example above):

    http://w-shadow.com/goto/A_Cloaked_Link/45/4&afsrc=1

  18. White Shadow says:

    Hmm, doing that may be possible, but I don’t understand how would that help against spyware?

    As for editing the files – if you’re familiar with PHP, you can take a look at the wplc_link_cloaking_plugin.php file, lines 87-90. This is where the final form of automatically cloaked links is determined. You could modify that, but then you’d need to also modify the URL rewriting rules on line 157 so that the links still work…

    If you explain how it’s supposed to work and why &afsrc=1 is good against spyware, I may be able to implement the changes myself and send you the modified file.

  19. Matt says:

    First of all, great plugin! Thank you!

    I’m trying to add NOFOLLOW tags to my cloaked affiliate links so the end result is:

    Test

    becomes

    Test

    Can you tell me which lines of the script I should replace, and with what?

    Thank you again!

Leave a Reply