Moin
December 2, 2025, 3:29pm
2
I think this might help:
Bulk Tag All Topics Within a Category
Template: rake tags:bulk_tag_category["<tag>|<tag>",<category_id>]
This would be particularly useful when trying to convert a category to a tag.
First, use the following rake task to find the relevant category ID.
rake categories:list
Tag all topics of the category you specify. In this example, you would be tagging all topics in the category with an ID of 6 with the “support” tag. this will remove all other tags from each topic.
rake tags:bulk_tag_category["support",6]
Append all topics of the category you specify. In this example, you would be adding the “support” tag to all topics in the category with an ID of 6, while keeping existing tags.
rake tags:bulk_tag_category["support",6,true]
And after tagging them, you probably want to move them to another category because you cannot delete categories containing posts.
Move all topics from one category to another
Find the category IDs with the following rake task:
rake categories:list
The first value should be the starting category ID. The second value should be the destination category ID.
rake categories:move_topics[15,6]
Rails Console Script
cat_from_id = XX # Category to move topics from
cat_to_id = XX # Category to move topics to
Topic.where(category_id: cat_from_id).update_all(category_id: cat_to_id)
Category.update_stats
CategoryTagStat.update_topic_counts
Using Performing bulk actions as a moderator might work too, but “select all” only selects all topics that were loaded. So, depending on the number of topics, it can still take a while.
6 Likes