If you would like to redirect unlogged user to custom login page (instead default login page) when he visits a page that requires being logged in (e.g. dashboard, messages, add listing etc.) you can use following PHP snippet.

You can add code into your functions.php file in child-theme or use WP Code plugin:

How to add PHP snippets?

Here’s PHP snippet.

add_action('template_redirect', function() {
    if (is_user_logged_in()) {
        return;
    }
    
    $restricted_pages = ['dashboard', 'my-profile', 'messages', 'bookmarks'];
    
    global $post;
    
    if (is_page() && $post && in_array($post->post_name, $restricted_pages)) {
        // Save the current URL to redirect back after login
        $_SESSION['redirect_after_login'] = $_SERVER['REQUEST_URI'];
        
        wp_redirect(home_url('/registration/'));
        exit;
    }
});

In following line add all pages you want to redirect:
$restricted_pages = [‘dashboard’, ‘my-profile’, ‘messages’, ‘bookmarks’]; 

and destination page: wp_redirect(home_url(‘/custom-login/’)); 


Custom Login Page

You can create custom login page using Elementor and login form shortcodes:

  1. [listeo_login_form] – displays both login and register in a tabs
  2. [listeo_login] – only login form
  3. [listeo_registration] – only register forms

You can place these shortcodes on any page where you want the respective forms to appear. For more details, you can refer to the Shortcodes section in the Listeo Knowledge Base.