Here is how to export media and then import it into another site. Feel free to correct me if I am adding an extraneous step.
The first step is to use WordPress’ export tool to export your pages, posts, or custom post types (I’ll get to media in a little bit).
Once you have exported your posts (whether they be pages, posts or CPTs), open up the exported XML file in sublime text. In Mac, I hold down Shift + Command + F to find all occurrences of a string of text and replace it with another string of text. Here’s a picture of what I mean.
In the Find portion, put the name of your old website, the one that you just exported from. In the Where portion, DON’T put a dot. The dot means “Search a bunch of files.” That was my bad. As you can see, it is searching and replacing stuff in EIGHT different files. That’s not what you want to do. Instead, put <current> in that field. See the picture below for an example. In the Replace portion, put URL of your new website. What does this do? Well, when you import these posts into your new site, it will ensure that there are no broken pictures or links referencing your old website.
I should probably add that I am doing this on local web development sites. I feel like this step should not be necessary, but, then again, it might just be a quirk of exporting and importing on local web development sites.
Now, you need to import it. Open up your new site, install the WordPress importer, and import your posts. BEWARE if you are importing custom post types. The custom post type must ALREADY exist on your new site. So, before you import your custom post types, make sure to register the custom post type on the new website. Here’s a picture of the import settings.
Please excuse my doodling, but wouldn’t that be ironic if all these extra steps were not necessary in the new update?
Okay, so, you’ve exported everything, replaced all the old URLs, and imported your posts. That was a lot of work! But, now, you realize all your pictures are broken! Whoops. Let’s fix that. As a side note, if you didn’t the search and replace step, your pictures would still be working, but they would be referencing the pictures on the old site. Go figure!
Now, you need to export all your media which is almost (if not more!) complicated than exporting and importing your posts. Let’s start that.
Go back to your old site and export all your media. OBVIOUSLY, this will not export all your media but will instead create a file that, when imported, will reference your the photos on your old site. I am being completely sarcastic, just in case you were wondering. The obvious thing would be for the exporter to export all the media files and prep them to be imported to their new location. Let’s, once again, fix that.
So, like I said, don’t import the XML file just yet. There is one more thing to do; although, this one thing is probably only necessary if you are exporting and importing media on a local website development environment.
Navigate to the location of your uploads folder (wp-content/uploads) and copy the uploads folder (yes, copy all your images and uploads. That’s what I said.) to your theme folder on your NEW site (yes, your theme folder). That’s what I did, at least. So, copy it to some folder like wp-content/themes/your-theme/temp-uploads on your new site. Now, open up the new XML file (the “media” XML file that you just exported). Instead of searching and replacing your old URL with your new URL, replace the old URL with the location of the temp uploads folder on your new site where you just copied your old media folder. Here’s a picture of that.
OKAY. If you have made it this far, GOOD JOB! One more step. Import the XML file into your new site. Okay, YOU’RE DONE! Celebrate. Go outside. Have some fun.
HOWEVER, if you were not able to make it through and have completely given up, feel free to contact me or leave a comment below.