How to pass username in affiliate link in wordpress website
I need to pass current logged in user in wordpress website as SUBID in the affiliate link as follows.
Affiliate link format is like below.
https://affiliatenetwork.com/track?id=myuseridurl=https://nike.comsubid={subid}
I want to pass current logged in user as a subid in above link. I have written below code in functions.php.
if ( is_user_logged_in() )
{
$userName = get_current_user_id();
}
----Need code here to pass $userName as subid ( mentioned in above link).------
Please help.
Topic url-rewriting php Wordpress parameter
Category Web