PHP If user is logged in & on home page redirect
First of all, home_url doesn’t provide anything. You should use the is_home() function instead. After that, you need to exit the script when you are trying to redirect. So, your full code should be like this: if ( is_user_logged_in() && is_home() ) { wp_redirect(‘http://example.com/’) ; exit(); } You should also hook into the right action … Read more