Affiliate Links



From Your WordPress Dashboard

  • Visit ‘Plugins > Add New’.
  • Click ‘Upload Plugin’.
  • Select zip-archive with plugin and click ‘Install Now’.
  • Activate Affiliate Links from your plugins page.


Via File Upload

  • Unpack zip-archive with plugin.
  • Upload the Affiliate-Links folder to your ‘/wp-content/plugins/’ directory, using your favorite method (ftp, sftp, etc…)
  • Activate Affiliate Links from your plugins page.


Once Activated

  • Visit ‘Affiliate Links > Settings’ and adjust the preferences.
  • Visit ‘Affiliate Links > Add New’ and create your first link.
  • Check your link works fine and enjoy plugin usage.


Plugin settings is available from the page ‘Affiliate Links > Settings’.


Here you can configure basic plugin options such as base part of redirect link and adding category slug to link URL.


Here you can configure default parameters such as nofollow HTTP header and type of redirect of new link.

Google Analytics:

Here you can configure Google Analytics event tracking for affiliate links clicks.


Reports in Affiliate Links give you the ability to see your links performance from month to month using graphs and stats. It has four sections: Links by Date, Browser by Date, Link by Date and Link Category by Date.

Links by Date

Links by Date reports allow to view links hits proportion for given period.

Browser by Date

Browser by Date reports allow to view browser usage proportion for given period.

Link by Date

Link by Date section shows link hits per day in a given range. Also Link by Date reports show you most used Browser, OS, Platform (mobile or desktop), Language, Referrer Links in a given range.

Link Category by Date

Category Links by Date shows links hits per day from selected category in a given period.

Link Replacer

Link Replacer feature gives you ability to replace old or wrong affiliate links in post content. Just input old url ( e.g. http://myblog/old-link) and new one and press “Replace!” button. Please be careful using this tool. Creating database backup will be a good point.


Affiliate Links plugin provides shortcode for embedding affiliate links into the post content.

[af_link id="1234" rel="nofollow" target="_blank" title="Link Title" class="btn-primary"]Click Here[/af_link]


  • id=”…” – Affiliate Link id(required)
  • rel=”nofollow” – add nofollow attribute (optional)
  • target=”_blank” – opens link in a new browser tab (optional)
  • title=”…” – add title attribute (optional)
  • class=”…” – add custom css class (optional)


Recent Affiliate Links:

Popular Affiliate Links:

Filters and Actions

Hooks in WordPress core, plugins and themes essentially allow you to manipulate code without editing core files. So you can change third-party plugin behaviour from your own theme or plugin and keep future updates as well.

Plugin Actions

  • af_link_before_redirect – allows you to insert custom code before the link will be redirected to the target URL, accepted args: $post_id, $target_url, $redirect_type.

Plugin Filters

  • af_link_register_post_type – allows changing of the post type registration arguments.
  • af_link_register_taxonomy – allows changing of the taxonomy registration arguments.
  • af_link_nofollow_header – allows changing of the nofollow HTTP header before redirect is processed.
  • af_link_target_url – allows changing of the target link URL before redirect is processed.
  • af_link_redirect_type – allows changing of the redirection type(301, 302, 307 etc) before redirect is processed.

Example 1

Let’s add custom variable to the target link URL dynamically generated by PHP.

add_filter( 'af_link_target_url', 'my_target_url_filter' );
function my_target_url_filter( $target_url ){
	$aff_id_value = 'your_value'; //some php here
	$target_url = add_query_arg( array(
		'aff_id' => $aff_id_value
		), $target_url );
	return $target_url;

Example 2

Let’s add custom HTTP headers when the affiliate link is redirected to the target URL.

add_action( 'af_link_before_redirect', 'my_header_action', 10, 3 );

function my_header_action( $post_id, $target_url, $redirect_type ){
	header( 'X-Custom-Header: cool!', true );

Sources and Credits

We’ve used the following javascript and PHP libraries as listed.

All of these libraries are licensed under the MIT license.

Can I use plugin without pretty permalinks enabled?

Yes, but your affiliate links would look have GET parameter like other post types.

Can I change the ‘go’ word in my links URL?

Yes, just visit plugin setting page and enter your own word.

What is Shortcode/HTML generator?

It’s a simple WYSIWYG tool for embedding your link into the site content. Just select options you need and copy&paste to the post content.

Can I insert affiliate links directly from the post edit page?

Yes, there is additional WYSIWYG tools on the post edit page:

Does plugin has Google Analytics integration?

Yes, you can enable Google Analytics tracking by entering your GA code to the appropriate field under plugin google analytics settings page.

What if I need this plugin customised?

We can help you tuning the plugin up to your needs, or even creating a new one from scratch, per your requirements. Drop us your request and we will get back with the estimate shortly.

  • Improvement

    compatibility with WP 5.7;

  • Improvement

    plugins updates and activation.

2021-03-22 ver 7.7.1

  • New

    the option for opening two links.

2019-11-21 ver 7.7.0

  • Fixed

    syntax errors.

2019-10-02 ver 7.6.1

  • New


2019-08-14 ver 7.6.0

  • Fixed

    saving settings issue.

2019-02-21 ver 7.5.5

  • Fixed

    html errors.

2018-12-19 ver 7.5.4

  • Improvement

    code optimization.

2018-11-12 ver 7.5.3



User icon

Your email address will not be published. Required fields are marked *