0

I have searched the net for explanations, but I only find my own question without any real answer. Like this one: Adding multiple user roles dynamically

I need to dynamically assign more than one role to some users. However, it seems that WordPress core is built for only one role per user. I have used Members plugin to define more roles. And they seem to reside in wp_options, along with the 'native' ones. But it seems impossible to update the user->role with an array.

Any suggestions?

1 Answer 1

2

Roles are assigned one per user. That's default for WordPress. Instead of using roles, I recommend using capabilities to keep track of different types of users. You can assign multiple capabilities per user and set some default capabilities for the role.

See: add_cap() and remove_cap()

1
  • Seems like a good piece of advice. I'll try that one.
    – hal
    Feb 20, 2019 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.