This code snippet creates a custom role showing every possible default capability.
/**
* Snippet Name: WordPress Create Custom User Role
* Snippet Author: ecommercehints.com
*/
add_role('custom_role', __('Custom Role'),
array(
// Super Admin
'create_sites' => false,
'delete_sites' => false,
'manage_network' => false,
'manage_sites' => false,
'manage_network_users' => false,
'manage_network_plugins' => false,
'manage_network_themes' => false,
'manage_network_options' => false,
'upload_plugins' => false,
'upload_themes' => false,
'upgrade_network' => false,
'setup_network' => false,
// Administrator
'activate_plugins' => false,
'create_users' => false,
'delete_plugins' => false,
'delete_themes' => false,
'delete_users' => false,
'edit_files' => false,
'edit_plugins' => false,
'edit_theme_options' => false,
'edit_themes' => false,
'edit_users' => false,
'export' => false,
'import' => false,
'install_plugins' => false,
'install_themes' => false,
'list_users' => false,
'manage_options' => false,
'promote_users' => false,
'remove_users' => false,
'switch_themes' => false,
'update_core' => false,
'update_plugins' => false,
'update_themes' => false,
'edit_dashboard' => false,
'customize' => false,
'delete_site' => false,
// Editor
'moderate_comments' => false,
'manage_categories' => false,
'manage_links' => false,
'edit_others_posts' => false,
'edit_pages' => false,
'edit_others_pages' => false,
'edit_published_pages' => false,
'publish_pages' => false,
'delete_pages' => false,
'delete_others_pages' => false,
'delete_published_pages' => false,
'delete_others_posts' => false,
'delete_private_posts' => false,
'edit_private_posts' => false,
'read_private_posts' => false,
'delete_private_pages' => false,
'edit_private_pages' => false,
'read_private_pages' => false,
'unfiltered_html' => false,
'unfiltered_html' => false,
// Author
'edit_published_posts' => false,
'upload_files' => false,
'publish_posts' => false,
'delete_published_posts' => false,
'read' => false,
// Contributor
'edit_posts' => false,
'delete_posts' => false,
)
);