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?

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()

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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