Ok, I know this should be easy but having trouble getting it working. I've tried all sorts of hooks, combinations, etc.. and the best I've gotten is it showing up once for the user. Of course, trying a second time sends them to the wrong page. Anyway, here's the code:
Basically, I'm trying to send a user to a different buy page if they are from Adwords. Pretty simple. The class I'm using is working and returning the proper data.
Located in the mu_plugins directory:
function adwords_redirect($query) {
// page should they be redirected from
if (is_page(832)) {
$aux = new GA_Parse($_COOKIE);
if($aux->campaign_source == "google" && $aux->campaign_medium == "cpc") {
//page they need to end up at
wp_redirect('http://domain.com/pricing');
}
}
}
add_action('pre_get_posts', 'adwords_redirect');
Any help is much appreciated. I'm stuck here and I know it's a simple thing I'm missing.