Skip to content

Instantly share code, notes, and snippets.

@verygoodplugins
Created June 8, 2017 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save verygoodplugins/d786beee2d663959939739308297fb1c to your computer and use it in GitHub Desktop.
Save verygoodplugins/d786beee2d663959939739308297fb1c to your computer and use it in GitHub Desktop.
Change Affiliate WP URLs to include affiliate email/ID in URL
<?php
function custom_awp_url($url) {
$user_meta = wp_get_current_user();
$user_email = $user_meta->user_email;
$url = $url . '?leadsource=' . urlencode($user_email);
// $url = $url . '?leadsource=' . affwp_get_affiliate_id();
return $url;
}
add_filter('affwp_affiliate_referral_url_base', 'custom_awp_url');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment