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
- 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 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 :
Yes, it should update the .htaccess even if you don’t actually change anything. It worked that way in older versions and it works on my WP 2.8-bleeding-edge install, so most likely that’s not the problem.
However, your .htaccess looks suspiciously empty; did it really contain just those two lines, or did my comment filters eat the rest?
Yes, the .htaccess is empty except for the two lines that start with the pound sign.
Is there something I can manually type in there to get this up and running?
I’m still confused how clicking “Save Changes” would know how to update the .htaccess file.
Thanks,
Neal
Ok, if I change the Permalink Settings to “Day and Name”, then the htaccess is updated and the cloaking works fine. However, if I change it back to “Default”, then the .htaccess goes back to the two line file. So it appears that the Default settings don’t work with the cloaking? Is that correct? Or a new issue?
Thanks,
Neal
Oops, so it appears WP will ignore plugin-created .htaccess rules if you set the permalinks to “Default”. I’d say this is a WP bug.
For now, select any other permalink setting to get around this problem. Hopefully I’ll be able to add a more transparent workaround to the plugin … eventually.
hi there, can you tell me how I can cloak links that dont appear in the post body – but are part of custom keys added to each post? I see the plugin reads through the actual body of posts and pages etc – but I have constructed my aff links using custom keys – and am calling them in the single post page.
I cant add static cloaks for all my links, so how do I get this to work?
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