Skip to main content

Multiple User Roles

WordPress core only ever assigns one role per user. Yoko Core turns the Role selector on the Edit User screen into a select2 multi-select, so a site can give a user more than one role — for example, editor and author at the same time.

This only runs when nothing else already does the job:

Plugin activeWhat runs
MembersMembers' own multi-role picker. Yoko Core does nothing.
PublishPress Capabilities (or Pro)Its own multi-role picker. Yoko Core does nothing.
NeitherYoko Core's select2 multi-select.

Members and PublishPress Capabilities both already replace WordPress's single-role model with their own multi-role UI, so Yoko Core steps aside the moment either is active rather than fighting over the same field.

Where it appears​

Users → All Users → (a user's name) → Edit User. The Role field becomes a multi-select: click to add a role, click the × on a chip to remove one.

It is not on the Add New User screen — core's own single-select Role field is left alone there, so a new user gets one role at creation and any extra roles are added afterward from Edit User. It is also not on your own profile page (Users → Profile), because WordPress core hides the Role field entirely when you edit yourself there.

Editing your own row from Users → All Users, though, does show the field — and this feature will not let you remove your own ability to manage other users' roles, the same way WordPress core protects that field everywhere else. Submitting a role change for yourself that would leave you without promote_users is rejected; your existing roles are left as they were.

note

Both the block editor and classic-theme/page-builder sites use the same wp-admin screen for user management, so this feature behaves identically regardless of editor or theme.

How it saves​

The multi-select posts its own field rather than the role field WordPress core reads, so core's own (single-role) handling never runs — this feature owns the save from submit to database. The same capability checks core enforces on its own Role field still apply: only a user who can promote_users, and specifically promote_user for that profile, can change roles, and only roles from get_editable_roles() are accepted. Anything else submitted is dropped rather than applied, and the user's existing roles are left as they were — WordPress still reports the save as successful, since a rejected role change is not treated as a form error.

Deselecting every role and saving removes them all, matching core's own "— No role for this site —" option.

Code​

includes/Admin/MultipleUserRoles.php, initialized from YokoCore::init(). assets/js/yoko-multiple-user-roles.js turns the <select> into a select2 multi-select.

role_management_plugin_active() checks for Members_Plugin (Members) and the PUBLISHPRESS_CAPS_VERSION constant (PublishPress Capabilities and its Pro add-on, which requires the free plugin and shares this constant).