Custom role with add_role
-
Hi there,
for my blog I am trying to add a custom role which is called ‘custom_editor’. This role should in addition to a normal editor also allow to edit theme options. But this role should only be created or added, if my theme is activated.
So at the beginning in the functions hooked to ‘after_setup_theme’ In put there
add_role( 'custom_editor', 'Erweiterter Redakteuer', array( // Additional Capabilities 'edit_theme_options' => true, // Editor Capabilities 'delete_others_pages' => true, 'delete_others_posts' => true, 'delete_pages' => true, 'delete_posts' => true, 'delete_private_pages' => true, 'delete_private_posts' => true, 'delete_published_pages' => true, 'delete_published_posts' => 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, 'manage_categories' => true, 'manage_links' => true, 'moderate_comments' => true, 'publish_pages' => true, 'publish_posts' => true, 'read' => true, 'read_private_pages' => true, 'read_private_posts' => true, 'unfiltered_html' => true, 'upload_files' => true ) );
The capability exists and I can apply it to users. But a user with this capability cannot edit the theme options.
If I edit the capability of editor instead by doing
$editor = get_role( 'editor' ); $editor->add_cap( 'edit_theme_options' );
all users with the capability ‘editor’ can then edit theme options.
What I am doing wrong?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Custom role with add_role’ is closed to new replies.