When we delete a category, what happens to the deleted topics in it?

When we delete a category, what happens to the deleted topics in it?

1 Like

You can’t delete a category while it has topics. You’ll see something like this.


You’ll have to either recategorize the topics or delete them before you can delete the category.


Yes, this button is disabled when the category has a topic, but if we delete the topics in the category, the delete button will be activated.

My question is, what happens for the deleted topics at this time? Can we find them somewhere to retrieve if they needed?

This question was raised when we moved topics from one category to another. Only the deleted topics remain in it and we saw that the delete key is activated. We also wanted to move deleted topics but found that the category of deleted topics could not be changed.

1 Like

We need to delete some categories and we want to do this via the delete button in the category settings. Their topics have been moved but many deleted topics remain inside them.

By doing this, will the deleted topics be completely deleted from the database along with their posts, or just their category field be updated to “uncategorized”?

1 Like

Since I don’t have any deleted topics I can’t test this, but I suspect you can go to the Title of the deleted topic and change the category to, say, uncategorized or to a hidden topic (maybe the better way so others don’t see) until you’re ready to retrieve them later. If you use a hidden category or topic, I would think you should undelete them when you move them to topic hidden category or topic.

AFAIK, re-categorizing a topic will update all posts’ and deleted posts’ URLs with the new category.

Unlike you, we have a lot of deleted topics and unfortunately, it is not possible to change them individually :sweat_smile: We have to change the category in batches.

On the other hand, when the topic is removed, it is not possible to change the category, and this causes it to do nothing more. We want to delete these categories but we do not know what the system behaves in this situation.

I think the only way left is to hide the categories instead of deleting them. That means we change the access to categories so that only admins can see them

1 Like

I went through all of the topics on my site and we do have a few that are hidden - the few posts made were moved to another topic. My mod had Closed and marked them as Hidden so only the mods and admin see them.

Is it possible to undelete the topic and then change the category? Still, that means doing so one topic at a time. :frowning_face:

Hope you can find an easy way to accomplish what you want.

When you close a topic and hide it, in addition to the administrators, those who also have the link can enter it (for example, people who have been notified of the topic or have an activity inside it).

Yes, it is possible to restore the topic, move it to a new category, and delete it again, but this cannot be done in batches.

Thanks for taking the time :pray: Discourse still has a lot of dark spots in the deletions, so we have to wait a little longer for this part to be completed over time.

1 Like

We tested this in an experimental environment. When deleting categories that contain deleted topics, the category_id field in the deleted topics does not change, and the only way to access these topics is to run the SQL query via Data Explorer. So we gave the query a list of valid category IDs and requested topics whose category_id is not in the list.

1 Like