Hidden Affiliate Links update version 0.2

There is a new version of this plugin. Please download it from the plugin page

After the first release of the Hidden affiliate Links plugin some bloggers wanted to know if this plugin would be able to automatically replace some keywords in posts and turn them into affiliate links.

John Chow bought a plugin for wordpress that does something like that from DealDotCom (yes it's an afiliate link and it was created automatically ) but I know it wouldn't be that hard to add such a functionality to my plugin. So here's the real deal they should put on DealDotCom:

Now my plugin will let you define keywords and it will replace those keywords (when you save/update a post) with a new link you can specify. And it will still work for adding such links manually as the first version does (just don't put anything into keywords or Link fields ) .

The keywords field is actually a field where you can specify a regular expression ( so make sure you escape special characters like - or . (dot ) by placing a \ ( backslash ) in front of them.

Example Use

Let's say you write a post and you want this plugin to replace both the keywords/phrases DealDotCom and "Deal Dot Com" then the content of the keywords column should look like DealDotCom|Deal Dot Com . The "Match slug" field can be go/dealdotcom and the "New link" should be something like "/go/dealdotcom" or "http://patchlog.com/go/dealdotcom" ( without the quotes ) - this is what it looks like on your blog.

Download new version

Hidden Affiliate Links v0.2 zip file / tar.gz file


If you have already installed version 0.1 you will have to deactivate from wp-admin -> Plugins and delete the table wp_hal_links then just install the new plugin like any other plugin.


Because the plugin allows you to specify regular expression for the " Match Slug" field you will have to escape some special characters like . (dot ) , _ , - and / by placing a backslash in front of them . I could make the plugin so that this will not be necessary but that would make it lose the great flexibility that regular expression matching can offer.


  • make it configurable so that the user can chose to match case sensitive or insensitive keywords and link slugs. At the moment the match is case sensitive but some users may not like that. It would also be nice to be able to specify this for each link.
  • give the user the option to replace the keywords at runtime (every time the post is rendered). This has the advantage that the keywords on all posts will be replaced ( not just the ones you update after you install the plugin ) but has the disadvantage that it can slow down your blog
  • Anything else you would like ? feed free to let me know in the comments...

88 thoughts on “Hidden Affiliate Links update version 0.2

  1. I’m there.. I run through some values corresponding to those you have above, click the “Add hidden link” button, and absolutely nothing happens, in FF and IE6. No errors, no values added, nada

    1. what wordpress version are you running ?
      The plguin uses wordpress ajax api to for adding those links so it may be incompatible with your version of wordpress.

        1. My best guess is that there are some browser security settings that prevent this from working. Do other ajax apps work for you ? go into wordpress admin and edit a post, at the bottom of the page there is a section named : “Custom fields” try to add a custom field… does it work? If it works does it reload the page ?

        2. The Problem is in your plugin. Please change $hal_version=0.1; in your plugin file: hidden-affiliate-links.php to $hal_version=0.2;

          This is the only problem, why people are not able to add a redirect link.

        3. very nice NSpeaks! i checked this scripts online via cpanel and live editing with this, i try to replace $hal_version=0.1 with $hal_version=0.2; and this plugin responds my clicked! nice now im working with new hal. anyone have the same problem try to read from the top and botton this comment list, backup your files and try to edit, use full.

          something that i want to warn anyone who using this scripts from old version into new version, before updating your script, make some backup of you database from wp_hal_links database table, if something goes wrong.

          anyway thanks for the plugin, nice !

    1. I haven’t really used Alinks, from what I know alinks automatically creates affiliate links from your keywords but does not hide the affiliate links. ( I may be wrong )
      At firts I just wanted a simple solution to manually add hidden affiliate links. but then some wanted to automatic replace feature and since it wasn’t hard to add I just added it

  2. Does this provide any clickthrough stats? The cloaking aspect is nice, but the stats are also important for knowing what’s working and what isn’t.

    1. I does not provide any stats yet. Maybe there will be stats in a new version.
      another idea if you want stats quickly is that you can modify the redirect code ( actually just a html page ) so that the redirect is done fully from javascript ( right now it’s done from meta and js ) and before the redirect you execute some javascript tracking code ( think google analytics code ) … google for something like “tracking rss subscribers with google analitytics ” and you shold find the solution…Maybe I’ll write a post about how you can do this …

    1. Thanks. Yes it’s using regular expressions to replace them. Actually what you put in the “Keywords” field is considered a regular expression not just a keywords list. So this is very powerful cause you can match a lot of stuff with it.

  3. Thanks for the quick reply, does this replace keywords in comments too? The way it is setup, I would think not – since it doesn’t determine it in run-time?

    Also, could you tell me if this is compatible with the aLinks plugin at all? The reason being that I would like to use the deep linking module of alinks and your plugin for everything else – is that possible?

    Again, nice plugin – stumbled the post πŸ™‚

    1. It doesn’t replace keywords in comments but I added that to my todo list. Watch out for the new version.
      I don’t know if it’s compatible with alinks because I never used alinks. If you try it let me know. In theory it should work…
      Thanks for stumbling the post!

  4. Having the same problem as a few others. Installed fine, but when I complete the fields, nothing happens when clicking on the ADD HIDDEN LINK button.

    I’m using IE7 and WordPress is 2.2.1

    Any ideas?

  5. I was having the same problem as most of the people here and then I looked at my 404 stats and noticed it was looking for a .js in the old versions folder, which I only had version 0.2 so I looked at the hidden-affiliate-links.php and found the version was still set to 0.1 if you change that to 0.2 it will work

  6. Well, I’m getting closer. I got it to accept a new link by implementing LazyBux’s suggestion (Thank You).

    I still don’t know if what I’m typing into each field is correct. If someone has some examples, I’d really appreciate it. Right now, I’m not messing with the keywords. I just want to create a hidden link for one of my affiliate links, not switch certain key words into affiliate links.

    Any suggestions and/or help is appreciated.

    1. The first field defines what will be redirected
      for example if the firs field is go/tla every link that matches that like http://patchlog.com/go/tla will be redirected

      The second column defines the keywords you want to replace . if you don’t want to replace any keywords automatically just leave it empty.

      The third column makes sense only if you fill in the keywords. Any matched keyword will be linked to the link defined in this third column

      The forth ( Redirect to Link/Code ) column defines the actual affiliate link where the visitor will be redirected if he clicks any of the nice looking links . This can be a link or some javascript code ( like the one you use for google adsense )

      The description is not that important but it is used on the pages that do the actual redirection so in case for some reason ( broken browser/network ? ) the redirection does not succeed this is what the visitors will see in the titlebar of their browser…

      I hope this clears things a bit…

  7. I have it to where it replaces the keywords etc but when I click on them it gives me a 404, so I have been going into my cpanel and creating redirects. Am I missing something with it automatically redirecting?

  8. FYI, both versions of HAfL are incompatible with Headspace 2, a meta-data management plugin from urbangiraffe.com. I may poke around to see if I can get them working together, and will report back.

  9. I’m not using the keyword facility, just simply replacing affiliate links but I am having a bit of a problem.

    When I add a link such as go/link123 it doesn’t take immediate effect and causes my blog to send users to a 404 page for a good couple of hours. Any idea why this is?

    1. Don’t use any caching as far as I am aware, however I have managed to find a solution. If I create a link, save it then go edit and update it works. Bit of a pain as it creates double work for me, but get there in the end.

      I have just come across another issue however;
      I create a link and call it “go/link3” this works fine. However later on I have created another link and called it “go/link30”. When I then use “go/link30” in a post for some reason it sends people to the URL listed in “go/link3” and NOT “go/link30”.

      I’ve tried this on different numbers and find “go/link20” doesn’t go to the required link, but sends people to “go/link2”.

      Is this a known issue?

  10. ok, I love the concept here. but I’d like some clarification if I can get it?

    what I think is supposed to happen is this.
    post in my wordpress blog, include a link to something, with a title ref, ala
    set the title ref, >fakecat in the first field to link to someother link that I’m promoting, like http://www.loliticz.com.

    So I’m thinking the text in the post should look like this?

    blah, blah, blah, fakecat blah, blah, blah… When you click on the fakecat link it should not take you to http://fakecat.wordpress.com/, but rather to http://www.loliticz.com

    Am I right? Is this what’s supposed to happen? If I’m just being too stupid for words, please feel free to tell me that, but also point me to what I’m doing wrong… kthxbai…

  11. ok, I like the concept of this. having some real issues making it work.
    my take on the process is:
    create post with link and title href and title tags
    use hafl to tag the link with new destination link? original link “some link” will now redirect click to “new link” and not show what the code is?

    If I’m correct so far, let me know? if I’m totally clueless, let me know the exact process, please.

    I’m running wp 2.3, I have HeadSpace2 turned off


  12. I get this error, Mozilla, 2.3.1 wordpress?

    WordPress database error: [Unknown column ‘keywords’ in ‘field list’]
    insert into wp_hal_links (slug,keywords,new_link,link,description)values (‘go/shareapic’,”,”,’http://www.shareapic.net/ref.php?owner=kimtiaz’,’Shareapic’)

  13. Hi, I can’t active the plugin (I am in a local network WP for now), it says:

    Parse error: parse error, unexpected $end in C:\Program Files\EasyPHP 2.0b1\www\wp-content\plugins\hidden-affiliate-links\hidden-affiliate-links.php on line 340

    Can you help me? Thanks!

  14. Installed. Applied fix as suggested in comments (why not just fix the download and save us all some time?) And lo and behold, hidden links just 404. Nice idea. Needs to work though (or have some clearer instructions)

  15. Hi,

    i want to replace all my links in the blog with match like “http://www.weblink123.de” to “http://www.weblink123.de/?aff=321432”. How does it works? I try, but without any result…

  16. I’ve tried the fix and it now reads version .2, however I still click the “add hidden link” and nothing happens. I’m using WP V. 2.3.2. Please help tried for hours to get to work.

  17. “I still click the “add hidden link” and nothing happens.”

    Me too I’m using WP V2.3.3 and had the same problem…

  18. To bad. Thats not working with WP 2.5 I still click the “add hidden link” and nothing happens. Older versions of WP works fine with the plugin.

  19. it’s not working for me either – and I’d love it to! I am not a techie so the fix above it outsid of my knowledge base? Please fix – I would love to tell more blogger friends about it once the bugs are gone!

  20. This has been the best affiliate link cloaker I’ve ever used — even among “professional” non-Wordpress cloakers. It’s quite possible I’ve come to rely on it TOO much.

    I really, REALLY hope you update this soon to work with WP 2.5!

    Thank you so much for your time and effort!

  21. I’m also very keen to use this with version 2.5, would be happy to make a donation in return. Clicking on the ‘Add Hidden Link’ button gives no response at the moment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.