I’ve created this topic because I don’t fully understand how the user deletion process works.
I thought that it was not possible to delete a user if it had posts. It seems there is even an informative message for this on the user page in the Admin panel:
Users can’t be deleted if they have posts. Delete all posts before trying to delete a user.
See for instance these related topics that mention that message:
Therefore, I would like to know how I can prevent staff members from deleting users with posts and get the informative message displayed. Is there any setting that I missed?
This is correct, but it’s a little bit more nuanced than it seems.
You cannot delete users who have posts older than the limit set in the delete_user_max_post_age site setting on your site. That setting defaults to 60 days.
So it works like this:
If the oldest post the user you’re trying to delete is 59 days old, you can delete that user. Deleting them will automatically delete all of their posts.
If it’s older than 60 days, you cannot delete the user. You would have to delete all of their posts first before deleting them. You actually won’t even see the delete button. You’ll see the message you mentioned in your post
Users can’t be deleted if they have posts. Delete all posts before trying to delete a user.
until you delete all of their posts.
If the defaults don’t work for you - like, say for example, you don’t want your moderators to delete anyone with posts older than 10 days - then you can change the delete_user_max_post_age setting on your site to match your needs.