How to restrict plugin’s sub-menu pages to admin/subscribers?

I am working on a plugin with 6 submenu pages. I want 5 of them to be accessible by Administrators only and 1 of them to be accessible by Subscribers only.

Both user roles will have different features available on their respective pages.

Is it possible to do that? If yes, how? If no, what are the alternatives?

Thanks for your time!

4 Answers
4

Is this right:
First 5 pages – Administrators ONLY, NO subscribers
Sixth page – Subscriber ONLY, NO Administrator ?

If this is correct than you only have to add the capability type as ‘administrator’ when creating the first 5, and ‘subscriber’ for creating the sixth. That should work. Or add a new capability for admin, use it while adding the first 5, and a new capability for subscriber, use it while adding the sixth.

Leave a Comment