Link Cloaking Plugin for WordPress

I’ve created a plugin for WordPress that can cloak outgoing links in your posts and/or pages.

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 (see examples below).
  • 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.
  • As of version 1.1, static link cloaking.

New! The premium version of this plugin is now available and includes several new features :

  • Cloak links in any part of your site, including the comment section and the sidebar.
  • Five new cloaking types – for example, you can display the cloaked URL in a frame, or use a special redirect that hides the referrer.
  • Improved link management and click statistics.
  • Free automatic updates.
  • And more. Check out EclipseCloaker.com for complete details.

Examples

Here’s a link explicitly tagged for cloaking -
<a href="http://evil-guide.tripod.com/"><!--cloak-->A Cloaked Link</a>
And here’s what it looks like in the post – A Cloaked Link
If you have configured the plugin to cloak all links (the default) you don’t need the <!–cloak–> tag inside your links.

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 Options -> Link Cloaking and modify the default settings to your liking.
  6. Re-save your permalink settings to insert the plugin’s link redirection code to the WordPress .htaccess file :
    • WP 2.7 and above : Go to Settings -> Permalinks and click “Save Changes”.
    • Older versions of WP : Go to Options -> Permalinks and click “Update Permalinks”.

Download

Version 1.3 : link-cloaking-plugin.zip (9 KB)

Requirements :

  • WordPress 2.2 – 2.8.4
  • mod_rewrite. If “pretty permalinks” work on your blog then you probably have this already.
Share :
  • Reddit
  • del.icio.us
  • Digg
  • StumbleUpon
  • DZone
  • Ping.fm
  • Sphinn
Related posts :

438 Responses to “Link Cloaking Plugin for WordPress”

Pages: « 1 [2] 3 4 5 6 7 8 9 10 1115 » Show All

  1. 19
    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?

  2. 20
    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

  3. 21
    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.

  4. 22
    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!

  5. 23
    White Shadow says:

    Just to clarify, the plugin is designed so that you can add the nofollow tag to the uncloaked link and it will stay there when it’s cloaked, too.

    Now, for your question – the quick & dirty solution would be to replace line 90 (the one that starts with “return”) in the file wplc_link_cloaking_plugin.php with this line :

    return '<a href="'.$url.'" rel="nofollow">'.$matches[4].$matches[5];

    Try it out. I have a sneaking suspicion that this might cause conflicts with other link rewriting plugins (and similar), but it should work well enough in most cases.

  6. 24
    Curtis Penner says:

    Hi White Shadow,

    I found your plugin just a couple of days ago. After trying several other plugins/solutions to cloak my links…and failing to get them to work, imagine my excitement when I turned on your plugin and it worked right out of the box.

    I LOVE it!

    One question…

    Do “hits” refer to actual clicks on those links or just page views?

    Curtis Penner

  7. 25
    White Shadow says:

    Hey, I’m glad you like it :)

    “Hits” refer to the number of times a link has been followed, so you could say it’s pageviews… except the “real” pageview count is probably lower, because search engines and other bots would also be counted as “hits”.

    Creating a reliable click stats report is nontrivial and I’m not aiming for that – the “Hits” figure is there to give a general idea about the link’s popularity only. You might want to find a separate plugin for accurate stats, or use Google Analytics. You can put the Analytics code on your blog with the Ultimate Google Analytics plugin (this is what I do on this blog).

  8. [...] Cloak Affiliate Links Что умеет этот плагин: Заботитесь о виде своих [...]

  9. 27
    Dolly says:

    Having problems with the 2.3 version of word press
    it seems to be slowing down
    Also it would not write to .ht access file
    Does it have anything to do with file permissions

  10. 28
    White Shadow says:

    What do you mean “slowing down”? Anyway, it’s probably something to do with WP itself.

    If Wordpress can write to .htaccess, so can the plugin, because it works from within WP. I assume you have tried updatibg permalinks, right?

  11. 29
    amy says:

    Hi.

    Great plugin. However I am getting a 404 when I use it. Do you know how to fix it?

    Thanks.

  12. 30
    White Shadow says:

    Do you mean you get a 404 when you click a cloaked link? If so, have you updated the permalinks?

  13. 31
    amy says:

    Yeah, I updated permalinks.

  14. 32
    White Shadow says:

    Well, I don’t have any other bright ideas then. Care to give me a specific example of a link that doesn’t work?

  15. 33
    Toni says:

    a couple of things

    i am noticing problems when using text link ads… specifically, the ads don’t work. I’ve tried updating the permalinks and everything, but when i click on a text link ad, it just hits an error page…

    this could pose a big problem for people using TLA

    second of all, i wish there was a way to cloak links on the blog roll….maybe not automatically, but manually in the wp-admin.. where for example, you can set ‘blogrolllink/aff?123″ to ‘mywebsite/blablabla’

  16. 34
    White Shadow says:

    I don’t know about text link ads, but for the second idea – try going to Manage – Cloaked Links, this might be what you’re looking for.

    I don’t have any TLA ads (at the moment) on this blog, so I really have no easy way to investigate this problem. Maybe, if you have “cloak all links” enabled, it might clash with TLA… try setting it to “selective cloaking” and see if it helps.

  17. 35
    Toni says:

    text link ads provides users w/a wordpress plug-in so that they can sell context text links on their blog. So for example, an advertiser might pay you…oh i don’ t know, $4/mo (for example) for the word ‘cloaking’ in your post….

    i’ve put link cloaker on selective cloaking for now

    would it be too much work to create a drop down…or some sort of menu…in the link cloaker adminstration that lists all context links on a blog with a check box to let you cloak or uncloak? this way you don’t have to go through each post and manually cloak your links on ’selective cloaking…’

    just a thought

  18. 36
    White Shadow says:

    It’s doable, but a lot of work. I’ll keep your suggestion in mind but I can’t promise anything.

  19. i’m also getting a 404 error. I’ve updated the permalinks and htaccess accordingly.
    my wordpress version is 2.3.1
    Please help me with this a.s.a.p
    Thanks!

  20. visit my site and click on a link in a post and you’ll see.

  21. 39
    White Shadow says:

    I looked at your site. I think the the problem is in the .htaccess. Where is your .htaccess located and what does it contain?

  22. 40
    cloudstrif3 says:

    i fixed the problem, the redirect.php file had to be in another folder called plugins within the orig. plugins directory. ex. plugins/plugins/redirect.php

    one more question, after a cloaked link is clicked, is there a way to cloak the url on the address bar? is there a plugin or script that can do this?

    a close example I can give are links on phazeddl.com and how .tk domains cloak site urls.

  23. 41
    White Shadow says:

    It’s good to hear that you got it fixed, though it still is a bug – it shouldn’t require another folder.

    I don’t know any WP plugins for cloaking the link in address bar, but I’ve seen various ways to do it in general. Frames (phazeddl.com uses an IFrame), JavaScript, etc. A quick Google search returns at least one free tool.

    The easiest solution would be to modify wplc_redirector.php, remove the redirection code (the last 3 lines or so) and instead create a single frame that contains the target page. This should be easy for anyone who knows a bit of PHP/HTML, but you’re on your own here. I don’t intend to add this feature to the plugin.

  24. 42
    cloudstrif3 says:

    Can you please help on creating a frame code.
    I don’t know how to insert the html code into the redirect php file

  25. 43
    White Shadow says:

    Fine. Open wplc_redirector.php and go to the end of file. Delete all lines that start with “header….” and the line that says “exit()”. Then insert the below code after the “?>” -

    <html>
    <frameset cols="100%" rows="100%">
      <frame src="<?php echo $url; ?>" scrolling="auto" frameborder="0">
    </frameset>
    </html>

    That’s a very primitive version, but it should work. Not tested.

  26. Hello,

    I get this error. Visit my site for an example.

    Parse error: syntax error, unexpected ‘<’ in /home/halcyonr/public_html/3magin8/site/2/wp-content/plugins/plugins/wplc_redirector.php on line 39

    This is the same problem I had before when I tried to do it myself. How do you insert an html code into a php file?

    Thanks!

  27. 45
    White Shadow says:

    PHP code is between “<?php” and “?>”, everything outside these separators will be treated as HTML. You should be OK inserting HTML after the last “?>” in the file. It is also possible to output HTML (or something else) from PHP code by using the echo function.

  28. 46
    Chirs says:

    Awesome plugin! Just what I’ve been looking for :)

    Is it possible to tell the plugin to encode not only the post content but also a custom tag?

    e.g. for ach of my blog posts I have a custom tag called ‘deeplink’ – how can I get the plugin to cloak this?

  29. 47
    White Shadow says:

    If the tag is added by another plugin and shows up inside the post when the post is displayed, you can’t really cloak it (at least not without some changes to the cloaking plugin… which might lead to new bugs).

    Arrgh, I need more information to really answer your question :P Is this tag part of the post or do you enter it in an additional field on the ‘Write Post’ screen? Also, if it’s added by a plugin, which plugin? It would be easier if I could look at the source code.

  30. 48
    Chirs says:

    Hey, thanks for your quick response.

    Yes, its one of the additional tags that you enter as part of the Write screen.
    I am able to reference it in my templates using:

    ID, “deeplink”, true); ?>

Pages: « 1 [2] 3 4 5 6 7 8 9 10 1115 » Show All

Leave a Reply