• 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 used manage_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 to Administrator role maybe on plugin_activate/updated hook

    • This topic was modified 1 year, 11 months ago by Bobz.
  • The topic ‘Custom Capability’ is closed to new replies.