# Removing all subcategories from an existing category

**URL:** https://meta.discourse.org/t/removing-all-subcategories-from-an-existing-category/115660
**Category:** Support
**Created:** [23.Апрель.2019 01:23:23 UTC](https://meta.discourse.org/t/removing-all-subcategories-from-an-existing-category/115660 "2019-04-23T01:23:23Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![L30110](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@L30110](https://meta.discourse.org/u/L30110)
#### Post date: [23.Апрель.2019 01:23:23 UTC](https://meta.discourse.org/t/removing-all-subcategories-from-an-existing-category/115660/1 "2019-04-23T01:23:23Z")

</div>

I have a category with a large number of subcategories, each of which may have a number of topic postings. Is there a simple way for me to remove all of the subcategories and cause the existing topic threads in the various currently existing subcategories to instead appear under the main category itself after the subcategories are removed? Thanks!

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [23.Апрель.2019 08:34:19 UTC](https://meta.discourse.org/t/removing-all-subcategories-from-an-existing-category/115660/2 "2019-04-23T08:34:19Z")

</div>

You can batch change categories by clicking on the batch select tool on the topic list and then re-assign categories to all the topics in one go.

That is the simplest way I can think of.

---

<div class="post-metadata">

### Author: ![L30110](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@L30110](https://meta.discourse.org/u/L30110)
#### Post date: [23.Апрель.2019 15:18:23 UTC](https://meta.discourse.org/t/removing-all-subcategories-from-an-existing-category/115660/3 "2019-04-23T15:18:23Z")

</div>

Hmm. Thanks, but that doesn’t seem to work, in fact it messes things up pretty badly. It only appears to impact the top-level category name, and leaves all the subcategories intact. It also only will apply to one item at a time, even when they’re all in theory selected! Which I definitely don’t understand. I can see how to probably do this one item at a time by switching each one to a new category name, deleting the original category with the subcategories, then recreating it without the subcategories and moving them all back in individually, but that is going to be VERY time consuming.

---

<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: [23.Апрель.2019 16:05:25 UTC](https://meta.discourse.org/t/removing-all-subcategories-from-an-existing-category/115660/4 "2019-04-23T16:05:25Z")

</div>

If you need to bulk move all topics from a category to another category you can use the rails console.

```plaintext
Topic.where(category_id: <from_category_id>).update_all(category_id: <to_category_id>)

```

Doing the move through UI, you are not able to select many topics (I think only the first 30 or so) so if you have many topics in a category you should repeat the move many times before finishing.

---

<div class="post-metadata">

### Author: ![L30110](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@L30110](https://meta.discourse.org/u/L30110)
#### Post date: [23.Апрель.2019 16:38:28 UTC](https://meta.discourse.org/t/removing-all-subcategories-from-an-existing-category/115660/5 "2019-04-23T16:38:28Z")

</div>

I was ultimately able to move the topics using the interface, but I can’t delete the original category because of the subcategories. I don’t see any obvious way to delete those. No doubt I’m missing something obvious. By the way, when I moved those topics, a bunch of notifications were sent out for those old topics. That was unexpected. Thanks again.

---

<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: [29.Июль.2022 08:34:54 UTC](https://meta.discourse.org/t/removing-all-subcategories-from-an-existing-category/115660/6 "2022-07-29T08:34:54Z")

</div>



---

<div class="post-metadata">

### Author: ![Bryan\_Joseph](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bryan_joseph/32/273248_2.png) [@Bryan\_Joseph](https://meta.discourse.org/u/Bryan_Joseph)
#### Post date: [09.Сентябрь.2022 19:57:57 UTC](https://meta.discourse.org/t/removing-all-subcategories-from-an-existing-category/115660/7 "2022-09-09T19:57:57Z")

</div>

У меня та же проблема:

 ![Screen Shot 2022-09-09 at Friday, September 9, 2022 12.54 PM](https://global.discourse-cdn.com/meta/original/4X/b/8/c/b8ce19195db66d5606b2a93397caec780b4a8793.png)  
 ![Screen Shot 2022-09-09 at Friday, September 9, 2022 12.54 PM 1](https://global.discourse-cdn.com/meta/original/4X/7/b/d/7bddb58ce4752255eaa4cee1b94d2a95a6a343f2.png)  
 ![Screen Shot 2022-09-09 at Friday, September 9, 2022 12.54 PM 2](https://global.discourse-cdn.com/meta/original/4X/d/b/5/db5059dfa2c8b35f6fe9b6662f1207af742c0ba8.png)  
 ![Screen Shot 2022-09-09 at Friday, September 9, 2022 12.55 PM](https://global.discourse-cdn.com/meta/original/4X/9/2/7/927291644ff174f37bb8b625de8eab8a0e5a1036.png)

Кажется, я удалил подкатегории, но Discourse всё ещё считает, что они существуют.
