Custom roles can’t access to wp-admin
i’m trying to create a custom role, very similar to admin but without the capabilities to edit/delete plugins.
Since i don’t wont to use plugin for that i’ve edited the functions.php file adding something like this:
// Add a custom user role $result = add_role( 'new_role', __( 'New Role' ), array( 'edit_posts' => true, // Allows user to edit their own posts 'edit_pages' => true, // Allows user to edit pages 'edit_others_posts' => true, // Allows user to edit others posts not just their own 'create_posts' => true, // Allows user to create new posts 'manage_categories' => true, // Allows user to manage post categories 'publish_posts' => true, // Allows the user to publish, otherwise posts stays in draft mode 'edit_themes' => true, // false denies this capability. User can’t edit your theme 'install_plugins' => false, // User cant add new plugins 'update_plugin' => true, // User can’t update any plugins 'update_core' => false // user cant perform core updates ) );
After that i can create with my admin profile a new user and assign him the role i just created.
All good untill the moment i log in with the new user when i have only access to the front page of the website.
I tried to add /wp-admin after the url but i get the message:
Sorry, you are not allowed to access this page.
I’ve tried to add this line in the array above
'manage_options' => true, //not sure about that
but without success, the block remains
Question: How i can, without installing plugins, make a custom user role access the control panel?