1. Home
  2. ReHub Theme
  3. Affiliate settings
  4. Bulk change for part of affiliate link (affiliate ID)

Bulk change for part of affiliate link (affiliate ID)

It’s very common situation when you have tons of offers on site and you decided to change affiliate ID in all existing links.

I will give you code for this. It will work only for affiliate buttons of theme (for Post offer section, Content Egg templates, offers which you added with Bulk import tool).

add_filter('rh_post_offer_url_filter', 're_link_change_custom_amazon');
function re_link_change_custom_amazon($offer_post_url){
$offer_post_url = str_replace('wpsoul-20', 'wpsoul-50', $offer_post_url);
return $offer_post_url;
}

instead of wpsoul-20 add your old affiliate ID, instead of wpsoul-50 add your new ID

Paste this code in functions of child theme or grandchild plugin

P.s.1 If you use COntent Egg and change deeplink in one of module, plugin will update your old links after price update for module. Unfortunately, this will not work for Amazon module due technical reason, so, you can use code above

P.s. 2 This code doesn’t change data in your database, instead of this, it will change your affiliate ID on site on fly, when someone open the page

Was this article helpful to you? Yes No

How can we help?