What is the code you are using?
Tom
(@tomhargreaves)
hi there,
you may be referring to my previous post so thought i’d give my input here.
the reply that i received in this forum also did not work for me, but after digging around i managed to get a solution:
add_action('wp', 'add_login_check');
function add_login_check()
{
if ( is_user_logged_in() && is_page( [6070, 6071, 6072, 6073] ) ) {
wp_redirect('http://my_homepage_url');
exit;
}
}
add this to your wordpress functions.php file.
you then need to replace the 6070, 6071, 6072, 6073 numbers to whatever the page IDs are for your login, register, lostpassword and resetpass pages (these can be found in the URL when editing the page).
and finally you can change the wp_redirect('http://my_homepage_url'); to whatever webpage you want the users to be redirected to.
hope this helped.
Jeff, I was using the code given in Tom’s question for redirecting users a few posts down but it wasn’t working. Fortunately, he provided a solution that worked like a dream. Thanks, Tom!
Hi @jfarthing84,
1. I’m using a plugin that makes a “PRIVATE PAGE” for every user.
2. I want to use your plugin to redirect logged users “subscribers” to they custom private page which is something like this: myurl.com/private/%username%
3. Can I write URL with variables in your plugin? in the custom location field?