force redirect users to respective sub-site (wordpress multi-site)

So does anyone know how to implement code that checks if users are a member of the site and if not, redirect them to their respective sub-site? Essentially, I am trying to restrict logged in users to the sub-site they are registered in, so when they try to access the main site or a different sub-site, they get redirected to their sub-site homepage.

Related posts

Leave a Reply

1 comment

  1. There are lots of WordPress plugins that allow you to do this sort of thing.

    I would recommend ‘Multisite User Management’. You will then simply need to apply a specific user role to each site, and edit the user role verification code to redirect users as appropriate.

    If this doesn’t help, I would advise searching for ‘User Roles’ and ‘Multisite User Management’ in the WordPress plugin search. There is a wealth to choose from and at least one of them should do most of what you need.