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. Dermot says:

    Hi thanks for such a great plugin!

    However, I have a question about the type of link created…

    Does the plugin produce 301 or 302 redirects?

  2. White Shadow says:

    It does a 301 redirect.

  3. Dermot says:

    Oops! Thought as much.

    I was using the plugin to cloak ebay links. However they recently announced they are not allowing 301 redirects and must change to 302.

    Can I do this within the plugin or would this total defeat the purpose of the plugin?

    Thanks.

  4. White Shadow says:

    Assuming you’re not averse to manual editing, you can change the redirect type pretty easily. Just open up wplc_redirector.php in any text editor and change line 42 from this :

    header("HTTP/1.1 301 Moved Permanently");

    to this :

    header("HTTP/1.1 302 Moved Temporarily");
  5. Dermot says:

    Got it, that’s perfect, thanks!

  6. Phil says:

    Hi

    Do you know why im getting this error message when i try to use the link cloaking plugin : http://www.pandadragon.co.uk/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=4579&link_num=2&cloaked_url=View/link/4579/2

    I have had to disable the plugin for now as it makes my site inaccessiable.

  7. White Shadow says:

    It appears that something on your site is blocking direct access to .php files in the /wp-content/ directory. For example, this works :
    http://www.pandadragon.co.uk/wp-content/plugins/link-cloaking-plugin/readme.txt

    … but this doesn’t :
    http://www.pandadragon.co.uk/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php

    Unless this block is disabled, the free version of the cloaker will not work on your blog. You could try the premium version though – it has a more sophisticated cloaking mechanism that won’t be affected by this problem.

  8. Phil says:

    Hi Thanks for your reply.

    Do you have any ideas what could be blocking it? i checked my robots.txt and nothing there?

    Thanks

    Phil

  9. White Shadow says:

    It’s more likely to be something in the .htaccess or the server config. itself.

  10. Phil says:

    HIya

    i used to have it working so i know its most prob not a server issue, also it works on four of my new domains :-S, i looked at htaccess one part did have a old sub directory in it so changed it but still nothing, perhaps if anyone else reading this has any ideas, i would be extremely grateful.

    Thanks

  11. Dermot says:

    Phil: you could try disabling your plugins one by one just to see if there is some conflict – maybe a recent plugin update might have triggered the issue

  12. Phil says:

    Hi Dermot

    I could do but my plugins mirror on all sites and i have link cloaking plugin successfully running on 4 of my 10 sites so i 95% sure its not a plugin conflict.

    Thanks for the suggestion though 😀

  13. tantan says:

    I got a malfunction today, although this has never happened before:

    I usually use to cloak the link, it works fine for me. Until my latest blog post (it today), doesn’t work. The cloaked link just go to my blog home page.

    Anyone can help me?! Thanks b4.

  14. White Shadow says:

    @ Phil : I still think it’s something in the server conf. that’s causing the problem.

    @ tantan : I’ve looked at the post you mention and I can’t find anything that would cause the plugin to not cloak the link. I’m guessing WP filters out or normalizes whatever is wrong with the link (if there is something wrong with it), so could you check it in the post editor and send me the HTML code corresponding to that link?

  15. Steve says:

    TanTan i’m having the same problem, it was working fine this morning and I haven’t changed anything. Now none of my cloaked links work, they just redirect to my ownsite/error page.

  16. roc says:

    I recently did the auto upgrade for your fantastic plug-in but now for some reason I’m unable to generate a new cloaked link for my static cloaked links? also all of the older cloaked static links have vanished?

  17. White Shadow says:

    @ Steve & others : Consider the premium version, perhaps?

    @ roc : Could you elaborate? Are you getting an error message, or is it something else?

  18. Steve says:

    Thanks, but i switched to another plugin and its working fine

  19. roc says:

    It simply does nothing now? I type in the name & url and click add and nothing happens? And the previous cloaked static links are gone the tables empty?

    So I deactivated the plugin and removed it and re-installed the previous version I have saved locally, and I can’t get it to work again? it does as the new version? weird, huh?

    I have been deactivated a previous plug which I upgraded so see if there may have been a conflict but I couldn’t get your plug in to work? It was working as you can see by the proof on the banner ads on the sidebar.

    Thanks for the lighting fast reply, btw

  20. White Shadow says:

    The fact that the “Add” button does nothing indicates that there is some kind of a JavaScript problem. Check your browser’s error console for details/error messages. To open the console, go to Tools -> Error Console in Firefox. In IE you need to double-click the error icon in the bottom-left corner of the window instead. Other browsers probably have something similar.

Leave a Reply