Through some echo statements, I poked around the code and came down to this line being the problem.
$postid = $wpdb->get_var(“SELECT post_id FROM $wpdb->postmeta WHERE meta_key = ‘$customkey’ AND meta_value = ‘$get_value’ LIMIT 1”);
$postid is not set correctly, and so when you get to this line:
$redirect_url .= ‘/?p=’ . $postid;
it doesn’t even execute the “then” portion. That’s why it’s just going to the default news page.
Any ideas on how to get this to work?