# How to delete all posts for an admin

**URL:** <https://meta.discourse.org/t/how-to-delete-all-posts-for-an-admin/147861>\
**Category:** Product Support\
**Created:** [April 13, 2020, 7:39pm UTC](https://meta.discourse.org/t/how-to-delete-all-posts-for-an-admin/147861 "2020-04-13T19:39:46Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)\
**Post date:** [April 17, 2020, 5:37pm UTC](https://meta.discourse.org/t/how-to-delete-all-posts-for-an-admin/147861/11 "2020-04-17T17:37:26Z")

</div>

OK, so you don’t actually about admin status here. Your goal is removal of posts? Suggestion for the future, let us know what you’re end goal is, not the current step you think will help you get there.

I don’t believe we have a rake task to delete all posts by a specific user. Let me test some things, I’ll get back to you.

OK. The following will allow you to delete all the posts by a user. You’ll need server access.

1. SSH into the server where Discourse is running.
2. Access the rails console of your Discourse instance.

```plaintext
cd /var/www/discourse
sudo ./launcher enter app
rails c

```

3. Obtain the id of the user you want to delete, then destroy all posts by the user. This assumes the username is `newsbot`, if it isn’t, **be sure to edit the command** ,

```plaintext
id = User.find_by_username('newsbot').id
Post.where(user_id: id).each do |p|
  PostDestroyer.new(Discourse.system_user, p).destroy  
end;

```

---

_[View the full topic](https://meta.discourse.org/t/how-to-delete-all-posts-for-an-admin/147861)._
