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

    You beauty! You’re right, I moved the Link Cloaker stuff to the top and now it works.

    Thanks a lot for your help and for this plugin.

  2. White Shadow says:

    Good ๐Ÿ™‚

  3. RichBeaver says:

    I’ve spend some time reading this article and I have to congratulate you for creating a WP plugin that’s doing this.
    I’ve wrote a small article dedicated to easy cloaking methods using JavaScript and PHP for others that are not so good with programming
    Link cloaking step by step guide

  4. learn japanese online says:

    Fantastic plugin mate,

    Thank you for releasing it!!!

    Have a Great 2008

  5. Christoph says:

    Hi, i wanted to use your plugin also. i uploaded it to the plugin directory, then, i activated it and updated the permalinks! but it doesn’t write any code in the htaccess file, so it doesn’t work! ๐Ÿ™ can you help me? any idea?

  6. Christoph says:

    do i maybe have to change something in the server admin menรผ?

  7. White Shadow says:

    I wouldn’t know about your server admin menus, but maybe you could try adding the code manually and see if it works? In most cases adding this to .htaccess should work :

    # Link Cloaker Plugin BEGIN
    
    RewriteRule more/([^/]*)/([0-9]+)/([0-9]+)/? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=$2&link_num=$3&cloaked_url=$0 [L]
    RewriteRule more/([^/]+)[/]? wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?name=$1&cloaked_url=$0 [L]
    
    # Link Cloaker Plugin ENDS
    

    The above code should probably be placed *above* any code that is already there.

  8. Christoph says:

    doesn’t work ๐Ÿ™

    my version of wordpress is 2.3.1 as i think.

    hmm… any other idea?

    my htaccess now looks like this:

    # .htaccess file create by vsa 3.2.9 webserver_rev 2.3
    AuthType Basic
    AuthName “Members Only”
    AuthUserFile /vol2/home/k102184web/.htusers
    AuthGroupFile /vol2/home/k102184web/.htgroups

    # Link Cloaker Plugin BEGIN

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

    # Link Cloaker Plugin ENDS

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

  9. White Shadow says:

    Eh, I forgot to mention to put your own option instead of “more” there; I think it’s “goto” by default.

    Other than that, I’d check if the scripts are there (yourdomain.com/wp-content/plugins/link-cloaking-plugin/) and if the redirector is actually getting called (check HTTP headers or something, if you know how).

  10. Christoph says:

    I changed it to goto, but nothing happened! hmm… how can i check, if the redirector is called? ^^ i’m not such a pro ๐Ÿ˜›

  11. White Shadow says:

    Well, a simple way would be to open wplc_redirector.php in a text editor and put something – anything – before the first “<?” string. Then click a cloaked link and see if the text you placed there shows up.

  12. Christoph says:

    i put “roflmao :D” before the first <?php and it appeard in the left corner of the whole website including the admin menu

  13. White Shadow says:

    I find that unlikely/strange. wplc_redirector.php should only be called when you click a cloaked link. Maybe you modified wplc_link_cloaking_plugin.php?

  14. Christoph says:

    oh ๐Ÿ˜€ you’re right ๐Ÿ˜€ i modified the wrong file! ;D;D

    but if i put it into the redirector.php file, nothing happens if i click on a cloaked link… he always says, that this page doenst exist oO

  15. White Shadow says:

    I think the .htaccess is to blame, because it doesn’t call the redirector… and that’s all I can say ๐Ÿ˜› If I was in a situation like this I would try to mess around with the .htaccess file, trying various things, to see why it doesn’t work. However, I don’t have a tutorial for that…

  16. Jay says:

    I met same problem with Christoph…:-0, hope I can find the solution soon….

  17. BrainWaver says:

    a BIG fat thanks for this plug!!

    Was going nuts because I had only 404s in the beginning, but found the solution in the comments here – maybe you can add it to the readme that the code in .htaccess has to be at the top – by default it is added in between and wordpress (2.3.2 on my site) adds the WP defaults to the end of the file again… so editing .htaccess manually seems to be a must.

    Now just have to manually redirect the sidebar links.

    All best and again THANKS for this one!

  18. White Shadow says:

    Good idea, I’ll add it to the readme.

  19. Christoph says:

    pls try to find a solution for my problem =\
    i need your plugin very much ^^

  20. White Shadow says:

    Eh, I don’t know. Maybe you need to put the plugin code before the authentication codes? Or something?… No new ideas :/

Leave a Reply