Discourse categories have a “Make new topics wikis by default” setting that can be enabled to automatically ensure that each new topic created within that category is a wiki from the start.
If you happen to enable this setting after the category has existed for some time, you may wish to make all of the old topics wikis as well. Here’s what you can do:
Make sure you backup your site just in case something goes wrong.
Get the id of the relevant category from the category’s URL. For example, the category id of this link to our #documentation category is
SSH into your server and run each of the following commands, replacing
<MY_CATEGORY_ID>with the actual id:
cd /var/discourse ./launcher enter app rails c tids = Topic.where(category_id: <MY_CATEGORY_ID>).pluck(:id) Post.where(topic_id: tids, post_number: 1).update_all(wiki: true)
That’s it! Your category has been wikified