Move topics to new category


#1

How do I move all the posts from one category to a different category?


Bulk move many topics from one category to another
Move all articles from 1 category to other and tagging
(Sam Saffron) #2

As staff you can use the wrench on the list to trigger multi select


(TheLoneCuber) #3

A question of curiosity @sam… why can’t you change categories at the page level? I’m sure there’s a reason, but it just seems odd if you’re viewing the post [at URL/t/post-title] that you have to navigate away from it to change the category.


(cpradio) #4

No you don’t. Scroll to the top and click the Edit Pencil next to the topic title. :slight_smile:


(Abram Bailey) #5

Just tried to do this on a category with a few thousand threads… Chrome crashed.


(Joshua Rosenfeld) #6

I’m not surprised. A few thousand topics is quite a lot to change at once. I’d suggest doing it in batches - say 100-200 at a time.


(Abram Bailey) #7

I ended up doing it in the console and it happened almost instantly. Thanks Joshua


(Abram Bailey) #8

If anyone wants to do something similar… Here’s moving a bunch of subcategory topics to a top level category:

category = Category.find_by(name:'Category Name')
category.subcategories.each do |subcategory|
  Topic.where(category_id: subcategory.id).update_all(category_id: category.id)
  subcategory.update(topic_count: Topic.where(category_id: subcategory.id).count)
end