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. White Shadow says:

    It works on the WP 2.5 blog that I tested it with, but you might need to update permalinks again.

  2. Ash says:

    Thanks, i update the permalinks and its working again.

    Many thanks

  3. Tim says:

    Thanks for this plugin!!

  4. xytheme says:

    Hey, great plugin you got here.
    I’ve been searching for this like forever.
    Installed and works like a charm.

    One question though, can it parse or cloak the affiliate url on referral image ads?

    If so, can you explain how to do this?

    Thanks.

  5. White Shadow says:

    If the image ad is simply a normal linked image in a post or page, then yes, the plugin should be able to cloak it automatically.

    If the ad is something complex, like Flash, JavaScript or an IFrame, or if it is located somewhere else – e.g. in the sidebar – then the plugin won’t cloak it.

  6. xytheme says:

    I got some 125×125 ads on my blog, when you hover on them, you will see the url. So, I want to cloak those links, is that possible?

    If not then I would have to create individual files and redirect the link manually.

  7. White Shadow says:

    I’m going to assume you mean they are not in your posts. In that case, you could use static cloaking for them. But yes, it involves some manual work.

  8. xytheme says:

    Well, I thought static cloaking is already in this plugin as per your post said? 😛

    Thank, nevertheless it is still a great plugin.

  9. White Shadow says:

    It is. The “manual work” refers setting up each cloaked link separately 😛

    Edit: Okay, let me expand on that. You can go to Manage -> Cloaked Links and add any referral links that you want cloaked. Then you can get the cloaked URL for any of those by clicking the appropriate “show cloaked url” link on that page. Finally, you need to modify your image ads to use the cloaked URLs instead of the original referral links.

  10. Bert says:

    Hello I found your plugin page on the GFY board, the thread start with this post below. Does your plugin hide affiliate links from search engines and prevent the leaking of pagerank like this script below?

    ____________________________________________
    Tip: Affiliate link redirects – Earn more money

    It’s friday and im in a good mood so thought i’d share this little tip with for any blog owners/site owners that have a lot of affiliate links on their pages.

    If you aren’t already redirecting them, well you should be and here’s how:

    Create a PHP file with the following code and your desired affiliate code/text.

    PHP Code:

    ——————————————————————————–

    http://www.realitykings.com/main.htm?id=fapgallery&p=clean‘,
    ‘college-fuckfest’ => ‘http://signupsb.triplexcash.com/cgi/click?account=560307&site=2&program=2’
    );

    if (array_key_exists($_GET[‘id’], $path))
    header(‘Location: ‘ . $path[$_GET[‘id’]]);

    ?>

    ——————————————————————————–

    Save it as link.php

    Then in your .htaccess file (create one if you dont have one) add:

    Code:

    ——————————————————————————–
    RewriteEngine On
    RewriteRule ^link/([/_0-9a-zA-Z-]+)$ link.php?id=$1
    ——————————————————————————–

    Now in this example i used a realitykings.com affiliate link with the anchor text reality kings.

    To include that link on my pages i would just add a link to:

    http://www.domain.com/link/reality-kings

    When clicked that will redirect to the sponsor link 🙂

    Remember to block the /link folder in your robots.txt file

    Benefits of this technique:

    1. SEO benefits – google isnt fond of too many affiliate codes on landing pages and it also helps prevent bleeding or diluting of your pagerank score.

    2. Prevent any pc tools or other malware stripping out or replacing your affiliate code.

    3. Earn more money!
    for example today’s nastydollars bonus day all i did was alter a few URL’s in the link.php file and now all my inthevip/vipcrew/ links all go through the reality kings tours.

    Tomorrow i can just re-edit that file rather than the 100’s of hard coded links on my sites.
    ___________________________________________________________

  11. White Shadow says:

    Yes, the plugin can do that. It can add the rel=”nofollow” attribute to cloaked links, which will prevent them from passing PR. You can enable this feature by going to Options -> Link Cloaking and checking “Nofollow cloaked links”.

    You could also do this by blocking the “link prefix” in robots.txt. By default the prefix is “goto”; it can be configured in the page mentioned above. This is basically the same thing the forum post suggests.

  12. Spitkicker says:

    Any way to make it work with the alinks plugin? It cloaks all the links created by alinks, but often if a post got 2,3 identical links only the first one works and rest kicks you back to the root of the site.

  13. White Shadow says:

    Probably there is a way, but I’m currently not inclined to seek it out.

  14. David says:

    What should i add with robots.txt prevent the search engines from spidering those links
    block them in robots.txt with:

    User-agent: *
    Disallow: ?????

  15. White Shadow says:

    If your link prefix is “goto”, you should add

    User-agent: *
    Disallow: /goto/

    In general, the form is “Disallow: /link_prefix_here/”

  16. […] geen enkele credit naar mij, alle kudos gaan naar Janis Elsts voor het ontwikkelen van deze geli(n)kte Wordpress […]

  17. Robert Jan says:

    This must be in my top 3 of coolest and more or less ‘hidden’ plug-ins out there. After following the instructions of updating the Permalinks (just save settings in 2.5) and moving the code to the top of the .htaccess it worked like a charm.

    I just had to dedicate an article to you. Thanks, great job!

  18. Make Money says:

    First of all I want to say great plug in. At first I had the 404. It was simply fixed by moving the lines in the .httacces file to the top of the file … works like a charm now

    # Link Cloaker Plugin BEGIN

    RewriteEngine On
    RewriteRule make_money/([^/]*)/([0-9]+)/([0-9]+)/? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=$2&link_num=$3&cloaked_url=$0 [L]
    RewriteRule make_money/([^/]+)[/]? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?name=$1&cloaked_url=$0 [L]

    # Link Cloaker Plugin ENDS

  19. Daid says:

    If your link prefix is “goto”, you should add

    User-agent: *
    Disallow: /goto/

    In general, the form is “Disallow: /link_prefix_here/”

    Thanks for your last reply,do i had to add Disallow: /goto/ ?
    If i don’t add Disallow: /goto/ ?
    What may happen ?

Leave a Reply