Change WP Discourse domain name

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.

image

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: Update URLs – Quick and Easy way to search old links and replace them with new links in WordPress – 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.

2 Likes

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.

2 Likes

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

Thanks much!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.