Topics link back to staging site

(Chris Handy) #1

Hello you, We publish posts to a staging site and then deploy it to our live account. Our discussion topics are linking back to the staging version of our URL. Any ideas on how to force linking back to the real URL?

(Simon Cossar) #2

The easiest way to do this would be to set the post’s permalink to what the permalink will be on the production site when the post is first published. To make this possible, I can add a filter to the permalink that is set on WordPress.

There may be some problems with timing if you use this approach. That would depend on how quickly sync your staging and production sites.

Edit: I think a better approach would be to wait to publish the post to Discourse until the post is available on your production site. If you publish the post from the production site instead of from the staging site the permalink will be set correctly.