Home > Mobile >  Allow specific user roles to log into WordPress site
Allow specific user roles to log into WordPress site

Time:01-26

I built up a membership site and i want only user can login if they have any of these user roles: administrator, tutor_instructor and club_members.

Could you please advise.

Thank you.

CodePudding user response:

The easiest way would be to use a custom code snippet or plugin with some custom code.

During the login process check the user role and redirect/logout.

Flow

Login > Check user role > If correct > redirect to membership page > else logout and redirect to membership sign up?. Though ideally, you shouldn't have any users signed up without the correct roles anyway.

CodePudding user response:

You could try using what's available on the plugin repository.

If the plugin does not work, a small functions.php snippet should do the job (try clicking the first 10 links in that second bullet).

  •  Tags:  
  • Related