• Resolved tmw2591

    (@tmw2591)


    Hello, I hope this can be done.

    We created an affiliate, however we would like to keep the referrers id throughout the site and not disappear, can someone please assist on this matter?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • gtsiokos

    (@gtsiokos)

    Hi there,

    What you’re looking for perhaps can be done using something like the following:

    function aff_urlparam_redirect(){
    	$pname = get_option( 'aff_pname', AFFILIATES_PNAME );
    	if( isset( $_COOKIE[AFFILIATES_COOKIE_NAME] ) && !$_GET[$pname] ) {
    		$location = esc_url( add_query_arg( $pname, $_COOKIE[AFFILIATES_COOKIE_NAME] ) );
    		wp_redirect( $location );
    	}
    }
    add_action( 'template_redirect', 'aff_urlparam_redirect' );

    This snippet will append the affiliate URL parameter and the affiliate ID to the URL you’re visiting, if the affiliate cookie is set.
    Hope it helps.

    Kind regards,
    George

Viewing 1 replies (of 1 total)
  • The topic ‘Keep ref id throughout site url’ is closed to new replies.