Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#48375 new enhancement

Introduce a separate capability for trashing a post

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: granular-capabilities needs-patch
Focuses: Cc:


Related: #41674

It's sometimes desirable to allow users to trash posts but not permanently delete them once trashed, nor empty the trash.

There should be a meta capability, trash_post|trash_posts, which by default maps to delete_post|delete_posts which is used when a post is trashed instead of deleted. This would allow a plugin to grant a user the ability to trash posts but not permanently delete them.

Change History (1)

#1 @desrosj
5 years ago

@johnbillion If a user with this capability trashes a post, and the trash is set to automatically empty itself after X days, then users with only this capability would technically still be able to permanently delete a post (though not immediately) because wp_scheduled_delete() does not check who trashed the post.

Because this capability would map to delete_post|delete_posts by default, this may be something that falls into plugin territory. But it came to mind thinking this one through and wanted to mention it here for thought.

Note: See TracTickets for help on using tickets.