# How can I delete or undelete topics?

**URL:** https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700
**Category:** Support
**Created:** [29 maart 2016 om 08:25 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700 "2016-03-29T08:25:18Z")
**Posts on this page:** 12
**Page:** 2

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [22 april 2016 om 14:18 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/21 "2016-04-22T14:18:34Z")

</div>

> [@alehandrof](#):
>
> I feel daft for asking, but I’m not able to find any documentation on how to do this. Any pointers?

There is no documentation for this unfortunately, as it is quite an advanced repair technique. I’m not sure how you’ve installed discourse but if you access the database you’ll want to issue a `DELETE FROM topic_embeds` - of course be warned that will remove all existing links between posts and embeddings. So if you have any in a good state they will be removed too.

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [23 april 2016 om 09:18 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/22 "2016-04-23T09:18:16Z")

</div>

I have three posts that were somehow undeleted, while all the rest are deleted (and refuse to be undeleted). I’m perfectly happy to deleted the three and unlinking them.

This would allow me to link me to create new topics based on the same blog posts, right?

If so, I’d like to try this.

My Discourse uses the vanilla Docker install in a Digital Ocean droplet. I have a local Vagrant version, which I’ve used to run experiments. For obvious reasons, I would liked to try this in the Vagrant version before doing it in production 🙂

I need a bit more help though. If I ssh into vagrant and open the console with `rails c`. What then?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [23 april 2016 om 09:33 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/23 "2016-04-23T09:33:42Z")

</div>

> [@alehandrof](#):
>
> If I ssh into vagrant and open the console with rails c. What then?

That’s a c for Console  
It will let you run Ruby from the command line.

Similarly you can `rails db` and run DataBase queries from the command line.

\*Hint, please do yourself a favor and save backups or be prepared and willing to start from scratch if things turn sour.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [25 april 2016 om 00:00 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/24 "2016-04-25T00:00:04Z")

</div>

> [@Mittineague](#):
>
> \*Hint, please do yourself a favor and save backups or be prepared and willing to start from scratch if things turn sour.

In other words: Footgun, batteries not included

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [25 april 2016 om 09:29 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/25 "2016-04-25T09:29:52Z")

</div>

> [@Mittineague](#):
>
> \*Hint, please do yourself a favor and save backups or be prepared and willing to start from scratch if things turn sour.

I’ll be working in my local Vagrant instance using a backup from the production docker. Starting from scratch is not an option at this point. We have migrated our Ning forum to Discourse and it’s now live and being used. There was, unfortunately, no indication in the embedding documentation available about any of these issues.

> [@eviltrout](#):
>
> if you access the database you’ll want to issue a DELETE FROM topic\_embeds

I’m still not sure what I’m doing. I tried this:

```plaintext
[vagrant@precise32:/vagrant (master)]$ rails db
psql (9.4.1)
Type "help" for help.

discourse_development=> DELETE FROM topic_embeds
discourse_development->
discourse_development-> \q

```

But it doesn’t seem to be working. Or I don’t understand how to test this.

I visited the local version of the website `http://www.example.dev/blog/profiles-and-events` but the “Continue the Discussion” link there tries to take me to old (deleted) topic at `http://localhost:4000/t/profiles-events/18`.

FWIW, I have `www.example.dev` as an allowed host.

Suggestions?

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [25 april 2016 om 10:28 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/26 "2016-04-25T10:28:59Z")

</div>

I think you need to end your statement with `;`, otherwise it thinks you are trying to write a multi-line query.

Example:

```plaintext
DELETE FROM topic_embeds;

```

---

<div class="post-metadata">

### Author: ![balibebas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/balibebas/32/100015_2.png) [@balibebas](https://meta.discourse.org/u/balibebas)
#### Post date: [19 juni 2018 om 11:27 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/27 "2018-06-19T11:27:27Z")

</div>

> [@Mittineague](#):
>
> To see it logged in as Admin I needed to go to `thesite/latest?status=deleted` to see it.

Just landed here after I deleted a topic I’d created under Discourse 2 and low and behold this sage advice still works to restore deleted topics. That’s awesome! 😄

---

<div class="post-metadata">

### Author: ![thaidb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thaidb/32/68488_2.png) [@thaidb](https://meta.discourse.org/u/thaidb)
#### Post date: [17 augustus 2018 om 07:32 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/28 "2018-08-17T07:32:26Z")

</div>

How can we restore topic discourse?  
I deleted content of first topic, so it’s lost, now i wanna restore them. How do i?  
Do Discourse have recycle bin topic?  
Thank you!

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [17 augustus 2018 om 08:42 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/29 "2018-08-17T08:42:59Z")

</div>

Search `example.com/latest?status=deleted`, find the deleted topic and click the Un-delete button

![image](https://global.discourse-cdn.com/meta/original/3X/a/4/a4612364d69aaacd7af1d603d9bf354755f6f3aa.png)

---

<div class="post-metadata">

### Author: ![Michelle\_tym](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michelle_tym/32/110349_2.png) [@Michelle\_tym](https://meta.discourse.org/u/Michelle_tym)
#### Post date: [5 september 2018 om 07:42 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/31 "2018-09-05T07:42:43Z")

</div>

> [@dax](#):
>
> `example.com/latest?status=deleted`

Thanks-you very much! Works perfectly 😘

---

<div class="post-metadata">

### Author: ![thaidb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thaidb/32/68488_2.png) [@thaidb](https://meta.discourse.org/u/thaidb)
#### Post date: [14 september 2018 om 08:02 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/32 "2018-09-14T08:02:56Z")

</div>

> [@Michelle\_tym](#):
>
> latest?status=deleted

How can i search or list all topic Make unlisted?

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [10 september 2019 om 05:59 UTC](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/33 "2019-09-10T05:59:59Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

[Vorige pagina](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700.md?page=1)
