Detecting $_GET parameters from any page + Cookie
This should work, though untested. <?php add_action(‘send_headers’, ‘affiliate_redirect’); function affiliate_redirect() { // it’s possible to use ‘if( !empty( $_GET[‘affid’]) )’ if( isset($_GET[‘affid’]) && ” != $_GET[‘affid’] ) { if( empty($_COOKIE[‘affid’]) ) setcookie(‘affid’, $_GET[‘affid’], time()+2592000, “https://wordpress.stackexchange.com/”); header(‘Location: http://mysite.com/about/’); exit; } }