Site Redirection Help
-
Hi, I am trying to set my site up with a “None registered users are redirected to a landing page” scenario.
I would like it so that all none registered users are redirected from all my pages (with the exceptions of only my registration, contact us, ToS & PP pages) to my landing page, NOT my home or login.php etc.
So how can I go about doing this properly?
I have tried using the following code but I just get a continuous redirect loop on normal WordPress pages and it seems to totally ignore my BBPress and BuddyPress pages, having them load no matter if the user is logged in or out.
This is the code I was using:
add_action('init','boot_non_users'); function boot_non_users() { $world_pages = array(106,101,105,102,70,82,50,67,103,104); if (!in_array(get_the_ID(),$world_pages)) if (!is_user_logged_in()) wp_redirect('https://www.carfreaksunite.com/cfu-login'); }
P.S.
I’m no coder and the above code was provided to me, so if anyone could provide help or guide me in the right direction of help (remembering I’m a noob at this), that would be awesome.Cheers.
- The topic ‘Site Redirection Help’ is closed to new replies.