Exporing/Importing posts in WordPress

We have recently had a client come to us and want us to migrate their site from a WordPress.com hosted site to a self-hosted WordPress.org bog with new pages, new functionality and a new style.

Normally that’s not too bad, but they were rushed, so we had to do a lot of work before we could get to the existing blog site. That was our mistake!

For those that don’t know. WordPress (both versions) allow you to export and import site content. This is a really handy system, and in the past has worked well for me when I’ve had to migrate entire sites.

The issue that we found on this particular job was that we only wanted to export the blog section of the site. That shouldn’t be a problem, should it? Just select to export the blog posts (the ‘Posts’ post type) and you’ll get everything. After all, that’s what import/export should be…

I say should be, because it doesn’t work quite that easily. When you export you can export everything, or you can choose to export a single post type. So, we exported the posts, and imported them into our new site. We got the posts in, so everything was good. Until we realised that doing this doesn’t include any of the media files that are linked in the posts, and also doesn’t include any of the comments that were placed on the posts.

I went back and looked at the export process again, and I saw that was “as expected” behaviour. That wasn’t too bad, so I exported the media and imported that, all good. Now for the comments. Wait, where’s the option to export the comments? Oh, there is none.

That’s right, you cannot export comments by themselves, but you also can’t export comments with posts. So how can you get comments as well? You export the entire site, including pages, custom post types and everything else that’s set up in it.

After I realised this I had a lot of work ahead of me. I had to set up another site to import all of the content into, import everything from the old site into the new site, delete all of the old stuff that we didn’t need any longer, and then I copy across all of the new content that was set up before. After all of this was done I could again export that from that site, and import it into a black version of the new site.

While this was possible, it’s nowhere near an optimal. The biggest thing that I’ve taken from this is that I now know that if anything needs to be imported from an existing site, it’s better to import everything right at the start and remove the bits that you don’t need.

Leave a Reply

Your email address will not be published. Required fields are marked *