Set default support landing page for non-registered users

Currently, if someone goes to the support page without being logged in, all the page says is "You must log in to get support". Is there any way to make the WP login page the default page people land on if they click on the support page when their not logged in?

If this is not possible, can I choose the default page?

Thank you!

  • Vinod Dalvi

    Hi @sinoun,

    I hope you are well today and thank you for your question.

    You can try achieving it by using any of the following code solution by adding it in the functions.php file of your child theme.

    add_action( 'admin_init', 'redirect_non_logged_users_to_specific_page' );
    function redirect_non_logged_users_to_specific_page() {
    
    if ( !is_user_logged_in() && is_page('add page slug or ID here')  ) {
    wp_redirect( 'http://www.example.dev/default-page/' );
        exit;
    }
    }

    Or

    add_action( 'template_redirect', 'redirect_to_specific_page' );
    
    function redirect_to_specific_page() {
    
    if ( is_page('add page slug or ID here') && ! is_user_logged_in() ) {
    
    wp_redirect( 'http://www.example.dev/default-page/' , 301 );
      exit;
        }
    }

    Change the page URL, slug and ID in the above code with the values from your site.

    Best Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.