I am buliding a plugin and have different menu options based on different user-role in wp-admin.

I have user role as Administrator, Subscriber since lastweek we had migrated to Multisite Admin and we have new role of Super-admin.

Now the issue is plugin displays all my menu twice in Super admin access. Following in the code used to different users. I am looking at not displaying the plugin menu for Super Admin.

public function setSubpages()
    $this->subpages = array(    

     // for Admin user          
            'parent_slug' => 'my_plugin', 
            'page_title' => 'Call Log', 
            'menu_title' => 'Call log admin', 
            'capability' => 'manage_options', 
            'menu_slug' => 'plugin_call_log_admin', 
            'callback' => array( $this->callbacks, 'adminCalLog' )
     // For other user / subscriber
            'parent_slug' => 'my_plugin', 
            'page_title' => 'Call Log', 
            'menu_title' => 'Call log telecaller', 
            'capability' => 'telle_caller', 
            'menu_slug' => 'plugin_telecaller', 
            'callback' => array( $this->callbacks, 'tellerCallerCalLog' )


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.