0

I would like to create multiple Admin roles to manage only particular custom-post types that I assign to them. They would not be able to add/edit/delete custom-posts that they don't have rights to.

Has anybody done anything like this before?

Thanks, Adam

  • If this is only about (custom) posts, why do they need to be admins? Doesn't editor role suffice? – kero Jul 24 '17 at 19:35
  • Yes Editor role would suffice - is this easier to do for editors? - to have them given rights to edit only particular custom post types of my choosing? – user1902789 Jul 26 '17 at 1:09
0

Yes it's very easy. You'll want to use the add_role() function to add your custom roles - https://codex.wordpress.org/Function_Reference/add_role

Then you can use add_cap to add custom capabilities - https://codex.wordpress.org/Function_Reference/add_cap

One important thing to mention is that both add_role and add_cap are saved to the database so they only need to run 1x so it's good to hook these functions into theme_switch, load-themes.php or if it's in a plugin using register_activation_hook

There is also another good answer can be found here with an example: Apply custom role capabilities to administrator (without plugin)

| improve this answer | |

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.