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

2
  • If this is only about (custom) posts, why do they need to be admins? Doesn't editor role suffice?
    – kero
    Jul 24, 2017 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? Jul 26, 2017 at 1:09

1 Answer 1

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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