Today I was working with a new client’s site where we’re moving him off of WordPress.COM over to a self-hosted .ORG site. He has 18,000+ posts on his site as well as a ton of media files.
As much as I’ve tried, I’ve never liked WP Migrate, and it was getting me nowhere trying to do a simple post export/import without pulling over entire database tables. Prior to that I’d attempted to export a WordPress WXR/XML file containing just posts, but that was yielding an empty file. This was even the case if I broke things up to just try one year at a time.
At my wits end I thought I’d just check and see if WordPress.COM has an SSH option. Turns out they do! So I logged on and started exporting posts one year at a time using the CLI:
wp export --start_date=2022-01-01 --end_date=2022-12-31 --post_type=post --with_attachments
Once my export started running, I saw why the WP Admin export was failing. Each year of posts was generating five or so XML files each totalling around 15MB. When I’d tried to do a year at a time, I bet I was running up against some limitation/timeout. Anyway, now that I was working with the commandline, I was able to do my exports, log on to my other server, wget
the files, and run a wp import
on the other side.
Leave a Reply