Is it possible to specify two usergroups (e.g. admins and editors) into the admin menu capability field ? I tried the following but it doesnt work:
add_submenu_page(
'my-top-level-handle',
'Page title',
'Sub-menu title',
array('administrator', 'editor'),
'my-submenu-handle',
'my_magic_function'
);
error message:
Warning: Illegal offset type in isset or empty in C:wampwwwwordpresswp-includescapabilities.php on line 712
Capability parameter of add_submenu_page() function can only take a single capability,
so if you are using the built in roles you can select a capability fro the long list that both administrators and editors have any of these
(use any of these freely):
As t31os said, you can use capabilities instead of roles there. One way to do this is to use core capabilities. (A more advanced method is to add a custom capability to the roles of your choice.) The default caps are in
wp-admin/includes/schema.php
in the functions called bypopulate_roles()
.If you are using standard roles/caps, you can specify only admins and editors by the cap
level_7
oredit_others_posts
or several others.