Create Custom Roles for Your Website

A Role defines a set of tasks a user assigned the role is allowed to perform. For instance, the Super Admin role encompasses every possible task that can be performed within a Network of virtual WordPress sites. The Administrator role limits the allowed tasks only to those which affect a single site. On the other hand, the Author role allows the execution of just a small subset of tasks.

[php]
/* Register Developer Role */
$result = add_role(
‘dev_admin’,
__( ‘Developer’ ),
array(
‘read’ => true, // true allows this capability
‘edit_posts’ => true,
‘delete_posts’ => true, // Use false to explicitly deny
‘activate_plugins’ => true,
‘add_users’ => true,
‘create_users’ => 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,
‘delete_users’ => true,
‘edit_dashboard’ => true,
‘edit_files’ => 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,
‘publish_pages’ => true,
‘publish_posts’ => true,
‘read_private_pages’ => true,
‘read_private_posts’ => true,
‘read’ => true,
‘remove_users’ => true,
‘switch_themes’ => true,
‘unfiltered_upload’ => true,
‘upload_files’ => true
)
);
[/php]