I am writing a wordpress plugin that redirects the user. for some reason, wp_redirect does not work as think it should, namely: it seems not to redirect the user at all, unless I put a die command in directly after. here is some code:
switch($_GET['wp_favorites_tax'])
{
case 'post_tag':
wp_redirect(add_query_arg('tag', $_GET['wp_favorites_term'], get_bloginfo('url')));
die();
break;
case 'category':
wp_redirect(add_query_arg('cat', $_GET['wp_favorites_term'], get_bloginfo('url')));
die();
break;
default:
wp_redirect(get_bloginfo('url'));
die();
}
It seems really strange to me that I should have to tell my script to die so that the redirect can work. I have also tried a basic
header("Location: $location);
to similar ends, ie: it still requires the die() in order to work. really perplexing me. Thanks.