Need logged in users returing to site redirected to a separate page

Add this piece of code to your theme’s functions.php file:

<?php 
    if (is_user_logged_in() && !is_page('YOUR PAGE SLUG') && empty($_SERVER['HTTP_REFERER'])) { 
        wp_safe_redirect( site_url('/members.php')); 
        exit;
    } 
?>

Assuming that your members.php is located at http://example.com/members.php. This will redirect any logged in users to that page.

Leave a Comment