Auth0 Home Blog Docs

Using the Wordpress plugin, assign roles to users based on AD manager status/group



I have some users from an Active Directory connection that are in different groups based on which custom roles I want them in in Wordpress. I have created the custom roles, with varying permissions.
A little like this:
| group_admin
| group_tech
| group_sales

I would like all members of group_users to have the role User, then admin, tech and sales to their respective roles (admin, tech, sales) based on the AD group.

Then, there are a few users in each group who are Managers. Those Managers should also get the Manager role in Wordpress.

My question is, which Auth0 Wordpress hook should I hook in to to change the role on first login?


Hi again @sc.atter!

How are these roles getting back to WordPress? Through the Management API or an ID token with a custom claim? Just curious about your implementation.

The hook that’s probably going to be the most useful is auth0_user_login located here:

… and documented here:

That will let you update the role if it ever changes in Auth0. Keep in mind that this will not keep role changes on WordPress synced to Auth0.


Hi! Thanks for the help. I’d intended on reading in the groups from Auth0’s metadata and matching to WordPress roles based on which groups were present there. (I’d made an options page in WP mapping groups to roles).

Turns out the client doesn’t want a groups-based role structure and we are going to do something a touch more complicated with other info from the AD. BTW - discovered the profile-mapper.js file, it is a lifesaver for something like this!