I have a WordPress-Site where some people (non-expert clients) need to create/manage users. The site uses multiple custom post types and each user is assigned permissions for one or several of those cpt's. At the moment i see two ways to handle this and i'm not very happy with any of them.

(1) User roles: If i have four custom post types (A,B,C,D) then i would need a lot of User Roles to cover all combinations of capabilities. (Role A, Role AB, Role ABD ...). That's not very convenient for the client to manage.

(2) Capability Management Plugin: If it was me to manage the users i would use a plugin like "User Role Editor". But that is quite complicated to handle for my non-expert clients and the risk of messing up the system is high.

What i think of is to have simple checkboxes (at least when creating a new user) where the client can choose the custom post types the new user should be able to access. Like: this user will be able to do everything with cpt A and B and D.

Is there a way to do this and is this even something you should do with WordPress?


@RyanLoremIpsum pointed me in the right direction so i was able to write a little plugin that is as simple as i need it to be. Looks something like that:

choose the cpt's a user should be able to access

  • That's great! Thanks for posting the final product. – iyrin Feb 15 '14 at 10:11
  • whats the name of your plugin and if its available for download – user54289 Jan 7 '15 at 1:15
  • @user54289 The plugin is not public, not really finished, not well written, not localized... But you can have a look at the code for a starting point: DNI User Permissions – Christoph Jan 7 '15 at 11:41

You don't necessarily have to assign roles to manage the user's capabilities.

First, register your custom post types with their respective capabilities. See capabilities under Function Reference/register post type - Parameters

Managing User Capabilities

You can use add_cap or remove_cap to add or remove user capabilities for a specific user.

// Add capability to a specific user  
$user = new WP_User( $user_id );  
$user->add_cap( 'can_edit_posts');  

// Remove a capability from a specific user.
$user = new WP_User( $user_id );
$user->remove_cap( 'read_private_posts' );

This is handy because it allows you to grant a user capabilities that do not belong to the user's assigned role.

For example, you may create a form with check boxes for each post type like you were saying. For each box checked, it would grant a given user ID the capabilities you created when you registered that post type. Likewise, unchecking a box could remove the capabilities.

  • You can also use the plugin "Members", that give you a UI for change roles and capabilities. – bueltge May 21 '14 at 9:50

protected by Pieter Goosen Mar 12 '15 at 18:23

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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