add_submenu_page set for multiple roles [duplicate]

I have this string:

add_submenu_page(basename(__file__), 'Events', 'Colloqui', 'subscriber', 'BW_events', 'BW_events');

How can I let this be available to editor(s) too? I tried …

add_submenu_page(basename(__file__), 'Events', 'Colloqui', 'subscriber, editor', 'BW_events', 'BW_events');

… but didn’t work.

1 Answer
1

add_submenu_page() and similar functions accept a capability. Capabilities are slightly confusing in WordPress as every role name is a cap as well. So instead of just adding a role name, you could just take a capability that is shared between the roles of the Subscribers and the Editors.

As you can see from the capabilities and roles table in Codex, read for example is a capability that every role in WP has.

Leave a Comment