How to Stop Accessing WordPress Page When User Login

Solution:

try this code bellow , put it within your theme function.

function my_page_template_redirect()
{
    if( is_page( 'page-slug' ) && is_user_logged_in() )
    {
        wp_redirect( home_url() );
        exit();
    }
}
add_action( 'template_redirect', 'my_page_template_redirect' );

Change page slug based on your case, you also can use page_id check these references bellow. Don’t forget to save permalink after put that code

Reference :

https://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect https://developer.wordpress.org/reference/functions/is_page/