Automatically Convert keywords to Affiliate Links in WordPress blog posts and improve the sales of products you are promoting. Earn money online by promoting affiliate products on your WordPress blog using the best affiliate management plugin.

Reasons to Mask or Hide Affiliate Links
It is always recommended to mask or hide affiliate links in your blog and there are quite remarkable reasons for that.
Google doesn’t encourage affiliate promotions on any blog
This is a fact and even confirmed by Google. In their recent Panda / Penguin algorithm update they considered affiliate products promotion seriously and punished many blogs. Only solution to this is to mask affiliate links and to add nofollow tag to them.
Direct use of Affiliate Links will effect your blog readership
If you are openly promoting products by including links directly in your blog posts, then it surely will effect your blog readership directly or indirectly. And it is good to link relevant keywords with affiliate links rather than manually posting them.
So by considering SEO factors and User experience, it is always necessary to convert keywords to affiliate links in your WordPress blog.
Learn How to Manage Outbound Links in WordPress
Automatically Convert keywords to Affiliate Links in WordPress
Coming to the implementation, you can follow any of these two methods based on the requirement and other factors.
Convert Keywords to Affiliate Links Using a Code Snippet
If you are just promoting one or two affiliate products in your blog, then you can use the below code snippet to automatically convert affiliate links.
Tip: Backup your WordPress Theme before Editing Files in it.
Just add this code to functions.php file in your WordPress theme. In case if you are using Thesis Theme, then add this code to custom_functions.php file.
function wp_affiliate_links($text){
$replace = array(
/** 'ENTER KEYWORD' => 'ENTER LINK HERE' */
'thesis' => '<a href="http://www.yoursite.com/affiliate-link-1">thesis</a>',
'genesis' => '<a href="http://www.yoursite.com/affiliate-link-2">genesis</a>'
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
add_filter('the_content', 'wp_affiliate_links');
add_filter('the_excerpt', 'wp_affiliate_links');
Just check the highlighted part in the above code snippet. In the left part, enter the keyword that need to be replaced with the affiliate link and in the right part, place the affiliate link in HTML format.
The desired keyword will be replaced with the affiliate link, whenever it is used in the content and excerpt part in your WordPress blog.
Thanks to Kevin from WPSnipp for this awesome code.
Convert Keywords to Affiliate Links Using a Plugin
Let us introduce you to a plugin called “MaxBlogPress Ninja Affiliate”, which is the best affiliate link management plugin for self-hosted WordPress blogs that comes with handy features.
Download and Install – Ninja Affiliate Plugin »
Immediately after installing ninja affiliate plugin, go to Tools > MBP Ninja Affiliate Admin page and follow these steps to mask affiliate links.
Add New Link: Click on “Add New Link” tab and fields to add a new affiliate link will be displayed. You need to enter a name, destination link, new link (with your site URL) and can also create Groups.

Here is how it will look after entering all details. Coming to the ninja link, we have chosen /go/ slug and you can use any other words also.

Enter Keywords: This is the important step and you need to enter some keywords, which will be linked to the desired affiliate link when used in posts or pages. You can use any number of keywords, but we recommend not to use more that 10 for a every link.

Options Page: You can set these options based on the conditions mentioned below. Another good thing is you can also exclude selected pages and categories from using affiliate links. Use nofollow tag on all links and open them in new tab by enabling the options below.

Now, it time to check the functionality of this plugin. Just create a new post with some keywords (which are used when creating a affiliate link) in it. You can notice that all those keywords will be automatically converted to affiliate links.
Check this one Theme Furnace – Premium WordPress Themes Download
So what else are you looking for? Go and grab the ultimate affiliate link management plugin by using this link
Hope you like this article on How to Automatically Convert keywords to Affiliate Links in WordPress and if you need any help, drop a comment here.


How to Easily Delete Old Post Revisions in WordPress
How to Add Next and Previous Links on Single Post Page
Display Blog Posts in Two Columns using Genesis Grid Loop
How to Add 3 Column Widgetized Footer to Genesis
How to Import and Export Content in WordPress
How to Disable or Limit Post Revisions in WordPress
This Would Surely Increase My Affiliate Sales
Yes Saad, MBP NF is one of the best premium WordPress plugins to manage affiliate links.
i have heard mbp is not secure right now…lot of loopholes in it..i have even contacted the support team but they never respond. a good alternative is gocodes or pretty link lite.
Nice post Bharath. I have never used this Ninja Affiliate plugin but going to use your code now.