Answer the question
In order to leave comments, you need to log in
How to redirect authorized Wordpress users?
Good day!
Everything is very trivial.
When visiting the site, non-registered users (of course) get to the main page.
Authorized users enter their personal account, but cannot return to the main page; because explicit redirect specified:
function homepage_redirect()
{
if ( is_front_page() && is_user_logged_in() ) {
wp_redirect( home_url( '/welcome_back' ) );
die;
}
}
add_action( 'template_redirect', 'homepage_redirect' );
Answer the question
In order to leave comments, you need to log in
You can set a cookie like 'welcome=true' for the login and, if available, address it to your personal account. If you need to return to the main page - rewrite to 'false' and redirect
function admin_default_page() {
return '/welcome_back';
}
add_filter('login_redirect', 'admin_default_page');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question