Affiliate Hide – Free wordpress plugin to redirect affiliate links!

A very simple and useful WordPress plugin to hide/cloak and redirect affiliate links based on custom fields. All you have to do is create a custom field `URL` in your wordpress post and specify the affiliate link there. This plugin can come in handy for gallery wordpress blogs where you are listing products or themes or services. Checkout this site and see how this plugin is practically used.
This plugin masks the affiliate links like shown below.
http://yourblog.com/jump/33 ——-> http://example.com
http://yourblog.com/go/33/ ——-> http://example.com
http://yourblog/download/33 ——> http://example.com
http://yourblog.com/link/33 ——-> http://example.com
http://yourblog.com/r/33/ ——–> http://example.com
If you see the above example, the number 243 is my wordpress post id. The plugin automatically queries the custom field value `url` in the wordpress post 243 and redirects to destination url. This plugin supports with or without trailing slashes.
Download (5kb)
Installation
1. Download the plugin, upload to wordpress/wp-content/plugins/ folder and activate the plugin.
2. Go to your blog post, create custom field `redirect_url`(can be any name) and enter the destination url in the value box.

3: Go to Admin > Settings > Affiliate Hide, enter the options you want

(i) URL trigger
Enter what trigger you want. eg. link, jump, go
If you enter `go` then your destination url will be hidden and show like http://yourblog.com/go/273. Once you click this the plugin will redirect to destination site
http://yourblog.com/go/273 ----------> http://example.com
assuming that your blog post has http://example.com setup under custom field with name ‘redirect_url`
(ii) Custom Field Name
Enter `redirect_url` assuming the redirect_url is the custom field you have created in your blog post, holding the destination url.
(iii) Link Text
Indicate what anchor link text you want. eg. Visit website, Download, Visit Author etc.
Another trick is, if you want to show a graphicimage instead of text, place img tag like
<img src="http://example.com/images/download.gif">
. No other html codes allowed except img tag.
For more information visit the authors site.
(iv) Trailing slash
If you want trailing slash in the url, select `yes` else `no`
yes -------> http://yourblog.com/go/273/ (with trailing slash)
no --------> http://yourblog.com/go/273 (no trailing slash)
default is no.
Save settings!
4. Finally open your template files (single.php, archive.php or index.php)
and place the code ……
<?php
if(function_exists('affiliate_hide')) {
affiliate_hide_print();
}
?>
Just make sure it is in the loop.
Frequently Asked Questions
1. How do i customize the URL for my needs?
I can give you so many URL ideas to hide your affiliate link. For example you can use `jump` `link` or anything in the URL. All you need to do is just edit the plugin php file for modifications.
You can use it with or without trailing slash. Enable or disable it in admin settings.
http://domain.com/jump/33 ——-> http://example.com
http://domain.com/go/33/ ——-> http://example.com
http://domain.com/link/33 ——-> http://example.com
http://domain.com/r/33/ ——–> http://example.com
2. How do i change the custom field name?
Just go to wp admin > affiliate hide > custom field and update it.
3. How to specify custom keywords for affiliate links?
At present this plugin does not have this feature. If you want to specify specific keywords i would recommend GoCodes Plugin where you have to manually enter specific URLs for defined set of keywords.
NOTE: i have recently spotted a bug with this plugin where the plugin will give 404 page not found error, if the URL contains special characters. The problem lies in the wp_redirect() function in the plugin php file. You have to replace that with header(“Location: xxx”) function to fix the problem.
Similar Posts:
- Affiliate Hide v1.0 – Free WordPress plugin to Hide & Redirect Affiliate Links
- Best affiliate plugins for WordPress!
- WordPress – how to add custom field when post is published?
- Using htaccess to redirect domain without http://
- 7 Useful WordPress plugins for Clickbank affiliates
- How to redirect when post submitted for review in WordPress
- How to get custom field value in WordPress?
- 10+ Best Tutorials for WordPress Plugin Writing & Development
- Problem with Custom rewrite rule in WordPress
- Where does wordpress store htaccess rewrite rules?


December 31, 2009
a detailed tutorial !
March 12, 2010
Hey thanks for releasing a great plugin but is there a way to get it to link to another custom field?
At the moment you can only change the link text or use a static image but I need it to link to a specific thumbnail for each post from another custom field.
Hope that makes sense.
March 12, 2010
Its very easy! Just open the plugin file and look for this code and put a IMG tag
function affiliate_hide_print() {
if(get_option('affiliate_hide_slash')) { $slash = '/';} else { $slash = ''; }
?>
/< ?php echo get_option('affiliate_hide_trigger');?>/< ?php echo the_id() . $slash; ?>">
IMAGE CODE
< ?php
}
March 12, 2010
Hi thanks for reply but I can’t get that to work following is my code:
function affiliate_hide_print() {
if(get_option(‘affiliate_hide_slash’)) { $slash = ‘/’;} else { $slash = ”; }
?>
<a target="_blank" href="//”>
<img src="ID, ‘Thumbnail’, true); ?>”
<?php
}
It doesn't output the image all I get is a red x?
March 12, 2010
Thanks but that’s what I’m trying wordpress stripped out my php from the comment:
http://pastebin.com/ijs9q9rt
March 12, 2010
use this function
get_post_meta($post->ID, ‘image’, true)
to output img src. wrap in php tags.
July 28, 2010
Thanks for the plugin! Will help me when I cloak my affiliate links!
October 3, 2010
Wow, perfect.
No idea how this has slipped past me until now.
Thanks,
Matt
October 20, 2010
Hi, I’m trying to use your plugin with url custom field that contains html code.. This theme require to use this:
My Link Title here
Do I need to add or change something on your plugin?
Thanks!
October 20, 2010
arg! damn links..
[a href="h++p://***.amazon.c0m" class="normal_button fl" > My Link Title here </a]
December 9, 2010
yes, you have to remove wp_redirect() function and if need be strip all html tags and use header() function to redirect.
October 20, 2010
sorry, my previous message came out without html code..
My Link Title here
hope this time works..
October 20, 2010
forget about this comment.. delete if possible.
December 15, 2010
very good plugin, thanks
February 5, 2011
Hi,
Do I need to change this part “wp_redirect($target, 301);” to fix the bug?
also, how do i add css styling on the text link please? thanks
February 5, 2011
yes, just open the php file and replace wp_redirect() line to header(“Location: $target”). Thats it.
February 5, 2011
thank you, i really love your plugin.
July 22, 2011
Your site does not render correctly on my iphone4 – you may wanna try and repair that.
I think one of your advertisings triggered my internet browser to re-size, you may well want to put that on your blacklist.
I just added this webpage to my google reader.
Thanks, I’ve been seeking for facts about this subject matter for ages and yours is the best I’ve located so far.
January 9, 2012
If I want have more than one affiliate link to hide,can I do that with this plugin?If Yes,How?
Thanks!
January 9, 2012
i mean,need to hide multiple affiliate link in one single post,how to do that?
January 9, 2012
You will need to create custom field variables, in your blog post with multiple URLs, and then tweak the code to redirect.
March 5, 2012
Hi, thanks for this great module. In our case the field containing the destination URL is not located in the table “wp_postmeta” but in “wp_posts”. The field is named “url”. Is it possible to retrieve this field to cloak the URLs?