How to Structure a New Role/Capability Scheme?

WordPress capability system roughly works like the following:

  • Capabilities can be attached to users or roles
  • Roles can be attached to users
  • Roles are a flat system, so there is nothing overruling something else
  • Role names are capabilities as well

Keep in mind that role names are capabilities as well, but you shouldn’t check against them. The same goes for the deprecated level-0 until level-9 caps.

In theory WordPress supports multiple roles per user – something that is extremely convenient as you can add and remove Capability packages summed under role names. It just has no UI and isn’t built in. Oh, and there’s (afaik) no plugin that delivers that.

So: yes assigning capabilities users is OK. But keep in mind that this can quickly can get a maintenance nightmare. In most cases it’s better (not perfect) to just grab a role, copy its capabilities over to your new role and add the new role to a user. When you then want to change something, just exchange to role for all users that need to have a new set of caps.

Note: This is my opinion. Others might have a different one when it comes to what is a nightmare and what not 🙂

Leave a Comment