• Resolved hamid009

    (@hamid009)


    I want to hide user profiles from each other, so only user it selft can access its own profile, This is doing it so far, but If I am opening logged out site.com/profile/ which is set as profile page it is redirecting me to homepage, I want it to redirect it to specific page or atleast register page

Viewing 1 replies (of 1 total)
  • Plugin Contributor Paolo

    (@paoltaia)

    Please try this:

    function redirect_to_register_on_profile_page() {
        if (is_page('profile') && !is_user_logged_in()) {
            wp_redirect(home_url('/register'));
            exit;
        }
    }
    add_action('template_redirect', 'redirect_to_register_on_profile_page');

    You can use the code snippet plugin or add the snippet to your theme’s functions.php file

    Let us know,

    Thanks,

Viewing 1 replies (of 1 total)
  • The topic ‘Profile Page Redirecting to Home Page when logged out’ is closed to new replies.