December 14th in Wordpress by pbu .

Affiliate Hide v1.0 – Free Wordpress plugin to Hide & 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.

NOTE: MOVED HERE (New Version 1.2)

This plugin masks the affiliate links like shown below.

http://exampleblog.com/go/243/ ——> http://domain.com/destination

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.

Download (10kb)

Installation

Step 1. Download the plugin, upload to wordpress/wp-content/plugins/ folder and activate the plugin.

Step 2. Open .htaccess file in wordpress folder and add this line

Add this one line

RewriteRule ^go/([0-9]+)/$ /index.php?go=$1

in your htaccess file. An example htaccess file shown below.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^go/([0-9]+)/$ /index.php?go=$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /topbest/index.php [L]
</IfModule>
# END WordPress

Step 3: Create Custom Field

Go to wordpress admin area, write a post and then create a custom field with name `url` and value is your affiliate url. You can customize and edit the plugin if you want another name (see below on how to customize)

Step 4: Place html code

Place the html code anywhere you want to hide the affiliate link.

<a href="/go/<?php the_id(); ?>/">Visit site </a>

If you are placing the code in viewpost, open /wordpress/wp-content/theme/single.php and place the above code wherever you want.

the_id() will automatically generate the wordpress post id.

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 anyting in the URL. All you need to do is just edit the plugin php file for modifications.

http://domain.com/jump/33/ ——-> http://example.com
http://domain.com/go/33/ ——-> http://example.com
http://domain.com/link/33/ ——-> http://example.com

Lets say you want to customize the plugin to use

http://domain.com/jump/33/

just follow the 2 steps.

1. Open .htaccess file where you previously place a rewrite line and change it to

RewriteRule ^jump/([0-9]+)/$ /index.php?go=$1

2. Use html code in your wordpress theme (single.php, index.php or archive.php) to suit the above incoming url.

<a href="/jump/<?php the_id(); ?>/">Visit site </a>

2. How do i change the custom field?

Lets say you have a wordpress blog with hundreds of affiliate links kept under a custom field `redirect` and you will need to modify the plugin code to use `redirect` instead of `url`.

Here is how you do it.

Open the plugin php file /wordpress/wp-content/plugins/affiliate-hide/affiliate-hide.php

Look for this line

$target = get_post_meta($_GET['go'], 'url', true);

change `url` to `redirect`

$target = get_post_meta($_GET['go'], 'redirect', true);

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.

Similar Posts:

Share and Enjoy:
  • del.icio.us
  • digg
  • StumbleUpon
  • Technorati
  • DZone
  • Facebook
  • FriendFeed
  • Reddit
  • RSS
  • Twitter

Leave A Comment.