如何将注销的用户重定向到WordPress中的不同页面

I am creating a website using WordPress. I am new to it. I have a separate homepage for logged out users and logged in users. Page for logged out users tells them to sign up or log in. And homepage for logged in users show them there profile. So the index.php is the homepage for logged out users. And i have created a different page freevideofy.com/home for logged in homepage.

I use plugin - login redirect to redirect them to freevideofy.com/home when they login in or sign up. And i use plugin - logout redirect to redirect them to freevideofy.com when they logout. But the problem is, if a logged in user closes my website, and again opens it by url - freevideofy.com then they are not automatically redirected to freevideofy.com/home.

So I want if logged in user opens the url - freevideofy.com, then he should be redirected to freevideofy.com/home. I think this function can be used - is_user_logged_in

As you said you didn't used any page builder or set a page as FrontPage ( using settings ), Wordpress should load your theme index.php file as homepage. So you have to edit wp-content/themes/THEMENAME/index.php file and add these two lines of codes:

if (is_user_logged_in() && is_front_page()) {
    wp_redirect(home_url('/home'));
}

If you feel a bit more streaky to edit the codes you can use the plugins for redirection also. Since WordPress uses enormous plugins that reduces our work and so i would suggest you to use these plugins for redirection.

Plugin Name 1: Peter's Login Redirect

Redirect users to different locations after logging in and logging out.

Plugin URL: https://wordpress.org/plugins/peters-login-redirect/

Plugin Name 2: Redirection

Redirection is a WordPress plugin to manage 301 redirections and keep track of 404 errors without requiring knowledge of Apache .htaccess files.

Plugin URL: https://wordpress.org/plugins/redirection/

Plugin Name 3: Redirect After Login

Redirect based on Role here.

Plugin URL: https://wordpress.org/plugins/redirect-after-login/

Hope so this will be the easiest method to do redirection based on the login roles and login status as such.

If so you need to do it via function in the WordPress you can do it better in this way.

Function Name: wp_redirect()

Description: Redirects to another page.

Note: wp_redirect() does not exit automatically, and should almost always be followed by a call to exit;

<?php
if(is_user_logged_in())
{
wp_redirect( home_url('/home') ); // This will redirect to the home page which we have created.
exit;
}
else
{
wp_redirect( home_url() );// this will redirect to the site main home page.
exit; 
}
?>