You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first author of a post has the ability to delete it (depending on status, etc), but co-authors can't. Wordpress checks the capability "delete_others_posts" for co-authors, even though they're an "author". Basically, to the co-author, the option to "Move to Trash" is not displayed.
A functional workaround: the co-author can rearrange the authors to make themselves the first author, save, then delete the post.
I added the following fix for our environment. It may not work properly with other environments/workflows.
function allow_coauthor_delete($allcaps, $cap, $args) {
if ($cap[0] === 'delete_others_posts') {
if ($allcaps['delete_others_posts'] == true) {
return $allcaps;
}
if (current_user_can('edit_post', $args[2])) {
$allcaps['delete_others_posts'] = true;
}
return $allcaps;
}
return $allcaps;
}
add_filter('user_has_cap', 'allow_coauthor_delete', 10, 3);
I don't know if this is the best way to fix this.
The text was updated successfully, but these errors were encountered:
The first author of a post has the ability to delete it (depending on status, etc), but co-authors can't. Wordpress checks the capability "delete_others_posts" for co-authors, even though they're an "author". Basically, to the co-author, the option to "Move to Trash" is not displayed.
A functional workaround: the co-author can rearrange the authors to make themselves the first author, save, then delete the post.
I added the following fix for our environment. It may not work properly with other environments/workflows.
I don't know if this is the best way to fix this.
The text was updated successfully, but these errors were encountered: