How to Export & Import Posts in WordPress Without Losing Images

If you've ever used the import/export feature in WordPress, then you know that image never carry over. Even if you select the media option, they don't appear. This guide will walk you through the hidden step needed to get this to work.

Why WordPress Doesn’t Import Images

When you use the export tool in WordPress, what you’re exporting is a xml file. By nature, xml files don’t contain other files, like images. Instead, they’re a coded map to help robots understand where to find things.

In this case, a WordPress export xml file contains instructions on where to put specific pieces of content. This even works if you’re using Advanced Custom Fields in the SEO Grid theme.

When you import that xml file, WordPress knows exactly where to put each piece of content, even images. But why won’t the images appear?

Essentially, without the images on the host, there’s nothing to put in their place. This guide will help you easily import the original images without having to install any additional plugins or do any fancy coding.

The Steps

Step 1) Find Images on SFTP

Before we dive into any steps in WordPress, we need to move the images from the original WP installation to the new one.

Login to your host’s SFTP and find your WP Contents folder. Within that folder, you need to find your Uploads folder.

Then, login to the SFTP on the new WordPress installation and find that Uploads folder.

Step 2) Copy and Paste Uploads Folder to New Host

Drag or copy/paste the uploads folder from the old WordPress installation to the new installation. Either overwrite that folder or add those images to the corresponding date folders.

Step 3) Export Everything From Original Site

Now that the images have been added to the new WordPress installation, it’s time to export the content from the original WordPress installation.

In the admin menu, go to Tools then select Export.

On the Export page, ensure that “All Content” is selected, then press “Download Export File.”

Step 4) Import XML File to New Site

On the new WP installation, go to Tools then select Import. This will present several options for importing content. At the very bottom, you’ll see WordPress. Select Install Now and then click Run Importer.

This will present a new screen where you can upload your XML export file.

Once your file has been uploaded, WordPress will map your pages and content to the images you moved over in step two.

That’s it! You’ve successfully migrated your WordPress site along with all of the images.