Change WP Discourse domain name

AI-generated summary

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 :star_struck: )

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?

thanks

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:

There are a few WordPress plugins that can automate the process of remapping this field. In the past, I’ve used the Velvet Blues Update URLs plugin. It seems that plugin is no longer supported. There is a forked version of it that I haven’t tried: Search & Replace Everything – Quick and Easy Way to Find and Replace Text, Links – WordPress plugin | WordPress.org. I’ve also seen this plugin recommended: Better Search Replace – WordPress plugin | WordPress.org English (Canada).

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.

Thanks.

When I click this checkbox in WordPress post editor:
image

And then hit “Update” to save the WordPress blog post. Then yes, the forum topic link is updated correctly.

Is that what you meant, yes?

I have a backup of WP. Will try your suggestion.

Do you think this issue could be related to this one, so that after updating the other error could be solved?

No, what I meant was to try just updating the field:

To see the custom fields section, you probably need to click “preferences” from the editor’s sidebar, then select Panels, then enable custom fields:

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.

This worked great! It caught replacements for Yoast as well. I did a dry run first and have backup still in case.

Thanks much!