Effect of changing the WordPress site URL

Thanks! The TopicEmbed embed_urls can’t be updated from the WordPress end, so if they need to be changed, you guys will have to do it. Ideally, Discourse would just follow the redirects to fetch the WordPress post’s content. It might be worth checking that the redirects are working.

If the URLs need to be rewritten, something like this can do it:

TopicEmbed.all.each do |embed|
  if embed.embed_url.starts_with? 'http://olddomain.com'
    embed.embed_url = embed.embed_url.sub 'http://olddomain.com', 'http://newdomain.com'
    embed.save
  end
end
3 Likes