Change WP Discourse domain name discussion summary
@haydenjames successfully changed their domain name but noticed that existing posts still showed the old domain. They found that manually updating the post by clicking “Update Discourse topic” and re-saving the post would update the URL correctly, but they were looking for a way to automate this process for over 100 posts.
@simon suggested using a WordPress plugin to remap the discourse_permalink post_meta field, recommending the Velvet Blues Update URLs plugin or its forked version, Update URLs, as well as the Better Search Replace plugin. He emphasized the importance of backing up the WordPress database before running the remap and performing a dry run.
@haydenjames confirmed that updating the post by clicking the “Update Discourse topic” checkbox would update the forum topic link correctly. They also asked if a related issue on the Discourse meta forum could be solved by updating the discourse_permalink field.
@simon clarified his previous suggestion, explaining how to manually update the discourse_permalink field to confirm that it would solve the issue.
@haydenjames reported that using the Better Search Replace plugin worked great, catching replacements for Yoast as well, and thanked @simon for the recommendation.
I successfully changed domain name by following the detailed instructions on the forum. (thanks )
However, when I log in to WordPress, even though I already I changed the domain set in the WP-Discourse settings, and it says connected but the existing/old post are still showing the forum post address using the old domain.
How/where can I update old posts to use the new domain name?
Note: If I click “Update Discourse topic” and resave the post, then the URL is updated correctly for the existing post. However, I would like not to have to manually re-save 100+ posts. Hopefully, there’s an easier way?
You can automate this process. I think the links that are pointing to the old Discourse domain that you are referring to are the links to Discourse topics that appear underneath WordPress posts. These links are set by the post’s discourse_permalink post_meta field. You could try manually updating that field for one of your posts to confirm that solves the issue:
The main thing to be aware of is that you need to use a remapping plugin that is able to update post custom fields. I think both of the plugins I linked to can do that. I’d also look for a plugin that lets you perform a dry run before performing the actual remapping. The second plugin that I linked to says it supports that.
Be sure to save a fresh backup of your WordPress database before running the remap. It would also be good to try manually updating the discourse_permalink field for just one post to confirm that solves the issue for you.
I’m fairly confident that just running the remap will solve the issue for you though. This would just be an additional check to confirm that it solves the issue.