Admin backend menu access for editor
-
Hello,
My problem is the exact same thing as wrinten in the documentation “How to manage WordPress backend menu” :
Scenario 1. Menu item has administrator capability assigned. This is quite common for a lot of custom menus and it means that user has to have the Administrator role in order to get access to it.
If you do not want to assign an user to the Administrator role, then simply create a custom capability administrator and make sure that it is checked for desired role or user. This is not a recommended solution but rather a “hack”.
But after reading all the documentation about creating policy and trying things for hours, I didn’t managed to make it work.
The thing is, I want the editor role to have access to the backend of the plugin but the menu need the administrator capacity.
My code :
{ "Version": "1.0.0", "Dependency": { "wordpress": ">=5.4.1", "advanced-access-manager": ">=6.5.2" }, "Statement": [ { "Effect": "allow", "Enforce": true, "Resource": [ "BackendMenu:admin.php?page=calendarista-index", "BackendMenu:admin.php?page=calendarista-sales", "BackendMenu:admin.php?page=calendarista-appointments", "BackendMenu:admin.php?page=calendarista-settings", "BackendMenu:menu-calendarista-index", "BackendMenu:menu-calendarista-sales", "BackendMenu:menu-calendarista-appointments", "BackendMenu:menu-calendarista-settings" ], "Action": [ "Role:editor", "Capacity:administrator" ] } ] }
I tried many different things, with URI or by changing the resources with the action but nothing works.
Plugin/Backend info :
Name Services
Capability administrator
URI /wp-admin/calendarista-index
ID calendarista-indexPlease if someone can help me, it would be much appreciated.
- The topic ‘Admin backend menu access for editor’ is closed to new replies.