# How to prevent user deletion if it has posts

**URL:** <https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392>\
**Category:** Product Support\
**Created:** [December 18, 2019, 12:04pm UTC](https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392 "2019-12-18T12:04:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)\
**Post date:** [December 18, 2019, 1:00pm UTC](https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392/2 "2019-12-18T13:00:15Z")

</div>

Hey Carlos 👋

> [@carlosjcabello](#):
>
> I thought that it was not possible to delete a user if it had posts

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.

---

_[View the full topic](https://meta.discourse.org/t/how-to-prevent-user-deletion-if-it-has-posts/136392)._
