Skip to content

Instantly share code, notes, and snippets.

@Glinkfr
Created April 1, 2019 10:51
Show Gist options
  • Save Glinkfr/a4fb53c20cf463bb524f8598fe49bddd to your computer and use it in GitHub Desktop.
Save Glinkfr/a4fb53c20cf463bb524f8598fe49bddd to your computer and use it in GitHub Desktop.
Ajouter un rôle utilisateur supplémentaire à WordPress
function modify_capabilities() {
$editor_role = get_role('author');
add_role('authorplus', 'AuteurPlus', $editor_role->capabilities);
$owner_role = get_role('authorplus');
$owner_role->add_cap('edit_others_posts');
$owner_role->add_cap('delete_others_posts');
$owner_role->add_cap('read_private_posts');
$owner_role->add_cap('delete_private_posts');
$owner_role->add_cap('edit_private_posts');
$owner_role->add_cap('unfiltered_html');
$owner_role->add_cap('moderate_comments');
$owner_role->add_cap('manage_categories');
$owner_role->add_cap('manage_links');
}
add_action('init','modify_capabilities');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment