So I have two sites. Old site with old domain and new site with new domain. I've exported some posts. They have images, so when I done the import, they obviously reference the old site. Some posts have galleries and again, these reference the IDs of the old site.

Is there anyway (I presume at this point that there is always a way!) to go through the posts, check if an image references an old site, if it does, import it and update the link to the new media item?

Likewise, would I be able see what IDs are being passed to a gallery, grab them somehow, import, update etc? I see this being the trickier task

I've wrote no code so far - just wondering whether this has been raised and/or done?


  • Do you have access to the MySQL database via phpMyAdmin? Also, are the images showing up as broken links or are they not transferring over? – ben.kaminski Feb 22 '17 at 23:17
  • Use any of migration plugins or Search Replace DB to make sure you've replaced all URLs in the database. – Max Yudin Feb 23 '17 at 8:44

you can use WordPress native functionality Tools->import/export for all your content or for some post type.

| improve this answer | |
  • 1
    That does not import the images that are used within a post – pee2pee Feb 22 '17 at 21:58
  • If you insert image into a post with WordPress media all will be fine. Try to export/import all post types(all site content). With this functionality work a lot of demo data importers for WordPress themes. – Oleh Feb 23 '17 at 10:08
  • No - doesn't work – pee2pee Feb 23 '17 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.