php - show custom plugin menu for custom user role user in wordpress -


i creating new user role "test_client" , it's working problem want show custom plugin page menu in dashboard in code "manage_options" 'true' plugin menu showing , if "manage_options" 'false' not showing plugin menu..

$result = add_role('test_client', 'test_client',      array(     // dashboard     'read' => true, // true allows capability     'edit_posts' => true, // allows user edit own posts     'edit_pages' => true, // allows user edit pages     'edit_others_posts' => false, // allows user edit others posts not own     'create_posts' => false, // allows user create new posts     'manage_categories' => false, // allows user manage post categories     'publish_posts' => false, // allows user publish, otherwise posts stays in draft mode     'manage_options' => true,     )     ); 

so how showing custom plugin menu in wordpress dashboard

add custom capabilities plugin menu

$result = add_role('test_client', 'test_client',      array(     // dashboard     'read' => true, // true allows capability     'edit_posts' => true, // allows user edit own posts     'edit_pages' => true, // allows user edit pages     'edit_others_posts' => false, // allows user edit others posts not own     'create_posts' => false, // allows user create new posts     'manage_categories' => false, // allows user manage post categories     'publish_posts' => false, // allows user publish, otherwise posts stays in draft mode     'manage_options' => fasle, 'cusotom_capability_name'=>true,     )     ); 

after add

$role= get_role('test_client'); $role->add_cap('cusotom_capability_name'); 

finally change in admin menu 'manage_option' 'cusotom_capability_name'


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -