Redirecting to a post based on a GET parameter and a custom field

remove the else after the foreach:

add_action('parse_request', 'fid_parse_request');
function fid_parse_request($wp) {
    // only process requests with "fid"
    if (array_key_exists('fid', $wp->query_vars) && $wp->query_vars['fid'] != '') {
        $args = array('post_type' => 'faculty_profile', 'meta_key' => 'wid', 'meta_value' => $wp->query_vars['fid'] , 'numberposts' => 1);
        $redirect_to_post = get_posts($args);
        if (!empty($redirect_to_post ) ) {
            foreach ($redirect_to_post as $p) {
                $link = get_permalink($p->ID);
                wp_redirect( $link , 301 );
                exit;
            }
        }
        $url="http://cnn.com/";
        wp_redirect( $url , 404 );
        exit;
    }else{
        return $wp;
    }
}