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.
- Works with plugin-created links.
- 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
- Download the link-cloaking-plugin.zip file.
- Unzip the file.
- Upload the `link-cloaking-plugin` folder to the `/wp-content/plugins/` directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- (Optional) Go to Options -> Link Cloaking and modify the default settings to your liking.
- 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.4.1 : link-cloaking-plugin.zip (9 KB)
Requirements :
- WordPress 2.2 – 2.9
mod_rewrite. If “pretty permalinks” work on your blog then you probably have this already.
oh – and just to add, im sure its pretty important – im trying to cloak a link which is an image – NOT text.
how can I do this in single.php (I am using custom keys as mentioned in my previous post)
Short answer : Can’t be done.
Long answer : A feature like this has been suggested several times, but I’m presently too lazy to update this particular plugin. I’d need to completely rewrite the cloaking algorithm to let it support cloaking arbitrary custom fields.
That said, if you only wan’t one specific field then it’s doable (but not easy). You might even find some relevant code examples in one of the older comments here. Basically, you need three things :
* A piece of code that grabs the link from the custom field and displays it in a special cloaked form (e.g. http://example.com/goto/custom/field_name/ ).
* An appropriate rule in .htaccess that ensures wplc_redirector.php will be called when a link like that is clicked (you can use the two existing cloaker rules as a starting point).
* Modify wplc_redirector.php to fetch the field name from the request, load the post in question, get the field value and redirect the user to that URL.
Good luck
hi, thanks for the reply, im afraid all of that is way above me and wouldnt have the first clue where to start (regardless of your tips
) if anyone can help me out – in terms of supplying instructions or code, that would be great. Im using a standard name throughout all posts for the custom key (deeplink) – and it never changes
fingers crossed
This is a seriously awesome plugin!
Thank you sooo much!
@ sebastian If you want to exclude a category you can replace some code in wplc_link_cloaking_plugin.php and leave the include on page unchecked.
Its just my simple hack, Its probably not the best way to do t, but saves time.
Replace:
function content_filter($content){
if (is_page()){
if(!$this->options['is_page']) return $content;
}
else if(!$this->options['is_post']) {
return $content;
};
with:
function content_filter($content){
if (is_category(‘YourCategoryslug’)){
if(!$this->options['is_page']) return $content;
}
if (is_page()){
if(!$this->options['is_page']) return $content;
}
else if(!$this->options['is_post']) {
return $content;
};
[...] Das Link Cloaking Plugin von und Janis Elts kann automatisch alle Links oder nur bestimmte Links “versteckt” werden. So können zum Beispiel Links von Partnerprogrammen “getarnt” werden. Das Plugin ist getestet bis WordPress 2.7.1 VN:F [1.2.3_620]Bitte warten…Rating: 0.0/10 (0 votes cast) Bookmarks setzen: Diese Icons verlinken auf Bookmark Dienste bei denen Nutzer neue Inhalte finden und mit anderen teilen können. [...]
Hi
I have been using the link cloaking plugin successfully in the post body etc. However I would like to use it in the sidebar as well using a text widget. I haven’t been able to get it to work so far. Is there a way to do this.
Thanks for your help. Roger
At this time, you can only use static cloaking in the sidebar. That is, manually create a cloaked link in Tools -> Cloaked Links and then use the cloaked URL in the widget.
Das sollte man beachten!!
Links in der Sitebar werden mit diesem Plugin nicht gecloakt.
Downloadlinks die z.B. auf eine externe zip Datei zeigen, funktionieren gekloakt nicht mehr.
Wer solche Links in seinem Blog anbietet, sollte die Funktion „einzelnes cloaken“ wählen.
I ‘m using piwik.
How to track outlinks from link cloaking?
Now, no track link cloaking in actions –> outlinks by piwik
[...] redirect. For each cloaked link I use a plugin called Link Cloaking Plugin. You can get it here: ø Link Cloaking Plugin for WordPress | W-Shadow.com ø Once it has been installed I cloak all links I want to use and then place the cloaked link in any [...]
[...] you use Wordpress, there is a good plugin for cloaking affiliate links, called ’Link Cloaking Plugin for Worpress’ (surprisingly!) which you can download for [...]
[...] Link Cloaking Plugin by Janis Elsts ‘Tis a dastardly contraption for fooling your visitors into thinking your [...]
[...] Affiliate link cloaking with Wordpress I am using this one on a WP 2.7.1 install ø Link Cloaking Plugin for WordPress | W-Shadow.com ø Perfect and [...]
cool plugin. i heard this is one of the useful plugin for seo purpose
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…
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”.
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…
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)?
Boy, I fat -fingered (or perhaps fat-brained) that post. Change “Does this problem” to “does this plugin”.
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?
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
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!
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.
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
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.
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.
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.
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
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