Use wp_safe_redirect instead of wp_redirect