Home › Forums › General Issues › Add additional role to user › Reply To: Add additional role to user
You add an acf/save_post action. In the action you get the value of the field and you get the user you want to add the role to and then you use $user->add_role().
I don’t have any code example. It would really depend on what user you’re adding the role to. The user being edited or the user being updated. Also you’d have to deal with the eventuality of the value being changed so you’d need to look at removing roles as well.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.