i need to redirect visitors who are coming from a certain url "http://www.example.com/wp-includes/qp2qp-sktcho/" tho their author page in wordpress "http://www.example.com/author/username" and i am using this code in one of the theme files
if($_SERVER['HTTP_REFERER']){
if($_SERVER['HTTP_REFERER'] == "http://www.example.com/wp-includes/qp2qp-sktcho/" && is_user_logged_in()){
$targetUrl = get_author_posts_url($user->user_nicename );
wp_redirect( $targetUrl );
add_action('pre_get_posts','wh_post_display_order_view');
exit;
}
}
but instead of redirecting to "http://www.example.com/author/username" it makes the redirection to "http://www.example.com/author/"
do you know what is worng with the code? thanks