I want to restrict users from deleting posts permanently. How do I restrict access to the Trash folder in Posts? This is the only page were the users can delete their posts permanently.
The only solutions that I have so far is:
1) Adding this to stylesheet:
li.trash {
display: none;
}
But both me and you know that this is a dummy fix and more importantly, it just hides the link that goes to the Trash folder for all users.
2) Remove the capability delete_posts
for none-editors. The problem with this is that the users will not be able to move their posts to the trash folder (which is a feature that is essential for my platform).
Do you know of a better solution?
With the filter we prevent the
Trash
link from being printed.And with the action, redirect back to the post listing page if the user tries to access the URL directly (
/wp-admin/edit.php?post_status=trash&post_type=post
).