Custom Capability
-
Could you please add a custom capability instead of
manage_options
I can then use some other plugin to add custom capability to certain roles, here’s the code you need to change.
In my example I usedmanage_instapage
class InstapageCmsPluginWPConnector, L:401 /** * Adds a link to WP admin sidebar. */ public function addInstapageMenu() { $iconSvg = InstapageCmsPluginHelper::getMenuIcon(); add_menu_page( __('Instapage: General settings'), __('Instapage'), 'manage_instapage', 'instapage_manager', array($this, 'loadPluginDashboard'), $iconSvg, 30 ); }
class InstapageCmsPluginWPConnector, L:73 /** * Checks if current user can manage the plugin's dashboard. * * @return bool Tru is current user has the permissions. */ public function currentUserCanManage() { return current_user_can('manage_instapage'); }
Additionally you would also need to add
manage_instapage
toAdministrator
role maybe onplugin_activate/updated
hook
- The topic ‘Custom Capability’ is closed to new replies.