0

I added a custom role this way:

add_role( 
'tabellenadmin',
__( 'Tabellenadministrator' ),
array(
    'activate_plugins' => true,
    'delete_others_pages' => true,
    'delete_others_posts' => true,
    'delete_pages' => true,
    'delete_plugins' => true,
    'delete_posts' => true,
    'delete_private_pages' => true,
    'delete_private_posts' => true,
    'delete_published_pages' => true,
    'delete_published_posts' => true,
    'edit_dashboard' => true,
    'edit_files' => true,
    'edit_others_pages' => true,
    'edit_others_posts' => true,
    'edit_pages' => true,
    'edit_posts' => true,
    'edit_private_pages' => true,
    'edit_private_posts' => true,
    'edit_published_pages' => true,
    'edit_published_posts' => true,
    'edit_theme_options' => true,
    'export' => true,
    'import' => true,
    'list_users' => true,
    'manage_categories' => true,
    'manage_links' => true,
    'manage_options' => true,
    'moderate_comments' => true,
    'promote_users' => true,
    'publish_pages' => true,
    'publish_posts' => true,
    'read_private_pages' => true,
    'read_private_posts' => true,
    'read' => true,
    'remove_users' => true,
    'switch_themes' => true,
    'upload_files' => true,
    'update_core' => true,
    'update_plugins' => true,
    'update_themes' => true,
    'install_plugins' => true,
    'install_themes' => true,
    'delete_themes' => true,
    'edit_plugins' => true,
    'edit_themes' => true,
    'edit_users' => true,
    'create_users' => true,
    'delete_users' => true,
    'unfiltered_html' => true
) 
);

As far as I know, this user should see every menu page. But only Dashboard and Users are showing. I tried to erase everything inside functions.php except for the above. No change. Do I miss something?

8
  • Where are you putting this code? Are you running it through any kind of filter?
    – Howdy_McGee
    Dec 3, 2014 at 18:12
  • No, I placed it inside functions.php they way you can see above. Dec 4, 2014 at 10:01
  • Do you have any plugins installed? If I run this code I exactly as it is - it works as expected, I see every menu setting.
    – Howdy_McGee
    Dec 4, 2014 at 14:50
  • Deactivating all plugins did not help. Dec 5, 2014 at 10:11
  • Maybe try wrapping it in an init action. Is this a child themes functions file or the core themes file?
    – Howdy_McGee
    Dec 5, 2014 at 14:52

1 Answer 1

0

The problem was, that I changed the capabilities AFTER I already created the role. I noticed, that if I change the roles slug, the role became duplicated. So I searched, and found

remove_role( 'tabellenadmin' );

Add that line somewhere before add_role(). You first have to remove the role, before you can change it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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