Profile Page Redirecting to Home Page when logged out

[ad_1]

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,

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer