1

I am creating a Super Admin role in wordpress Roles.

$capabilities=array();
add_role('Administrator', 'Administrator', $capabilities ); 
add_role('Super Admin', 'Super Admin', $capabilities) ); 

So while adding a new user I got the Role Option Super Admin. So I added a Super User .

Now When I login to wp-admin It gives me error saying:

you do not have sufficient permissions to access this page.

What more I have to do to make it work. I dont want to use any pluggin.

I tried this too

add_role('Super Admin', 'Super Admin', 
array("manage_network","manage_sites","manage_network_users",
"manage_network_plugins","manage_network_themes","manage_network_options",
"read") ); 

and

  add_role('Super Admin', 'Super Admin', array("manage_network"=>true,"manage_sites"=>true,
"manage_network_users"=>true,"manage_network_plugins"=>true,
"manage_network_themes"=>true,"manage_network_options"=>true,"read"=>true) );

I want this user to access all stuff in wp-admin panel

0

the best solution to change WORDPRESS role and capabilities is to use User Role Editor plugin. It is simple, very efficient and also give you power to add and modify both roles and capabilities.

0

But you can do all with code without any plugins.

For example, here are my class UserRoles which do that all and a bit more (maybe it's not perfect, but it works well). Just set const arrays with users & them caps (search them here). You can see roles 'dramatist' & 'free' as examples of new roles.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.