There are many answers to how to redirect after login. But my situation is different. In my scenario, we have a landing page where people can login. Once logged in, the users are not logged out for a year. So, what we want to do is, when the user visits the site, check if they are logged in. If they are logged in, automatically redirect to a specific page. I used a plugin to embed this code on the landing page, but it does nothing :
<?php
if (is_user_logged_in()) {
wp_redirect( 'https://our.domain/specific-page/' );
exit;
}
Edit: I added echo statements before entering the if block, after entering the block, after calling wp_redirect, and, after exit. When I look at the page source, all the echos are printing, except the one after exit.