3

I have two WordPress sites, one (the "main") is used for my org's website (using Pages + Media), and a second was setup as a blog (using Posts + Media).

We want to get rid of the blog WordPress site and move all the posts and media to the main WordPress site.

I've exported posts from the blog using Tools -> Export.

Then I use Tools -> Import on the main site to import the posts, and I select "Import Attachments: Download and import file attachments" (I check the box).

But then when I go look at the posts that are brought in, they are still pointing to the old site (perhaps because it's a subdomain of the main site, even though it's hosted elsewhere? Is there a dumb string comparison that is failing here?)

So then I thought maybe I could export/import all of the media (thousands of photos) and just use a script to edit the XML so that it points to the media on the main site, but when I try to export/import all the media it keeps crashing after doing just a few, presumably because of upload size limitations?

What's the proper way to do something like this?

I know there are lots of plugins that do backup/restore, but I don't want to do one of those unless I can select which portions it restores, and also know that it won't delete what is already there.

The main site has pages and media, and the blog site has posts and media. I want to bring over all the blog media and posts, without losing any of the main site pages and media. Is this possible?

1 Answer 1

0

I understand your hesitation to use a plugin that doesn't have granular options to avoid overwriting existing content when what you're actually doing is a merge more than a restore.

You could simply use phpMyAdmin perform a search & replace on the incorrect links via a SQL query. I'd suggest cloning what you have now (merged content with links pointing incorrectly) to a sandbox installation to test this first, or if that's not possible then be sure to backup your full DB, just in case you have unexpected results.

If you're not comfortably familiar with writing SQL queries, then I'm sure there are others who could help with suggestions (I always need to research writing queries very carefully first!).

Alternatively there are plugins that do just specifically that - search and replace text strings (in this case, links) - in a simpler interface than using phpMyAdmin and writing the SQL query yourself.

2
  • I'm actually not worried about the search/replace, I can just manually edit the posts.xml before I import it. But that doesn't help if the media isn't there. I need to get all the media from one blog to another and don't see a way to move them in bulk. Mar 13 at 3:05
  • Got it, I misread your question and thought the issue was where the links were pointing.
    – Trisha
    Mar 14 at 4:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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