How to Export and Import Images in Wordpress

Exporting/importing your entire WordPress Media Library is fairly straightforward and can be achieved using WordPress’s built-in export/import tool, FTP or other file management tools that allow you to work at the file-folder level, or a plugin specifically designed for this purpose

On the other hand, exporting and importing images in website builders for photographers such as WordPress along with their specific posts, pages, etc., can present bigger challenges, especially on the import side.

Exporting WordPress Posts with Images

To demonstrate techniques, we’ll use the WP All Import/Export plugins. If you want to follow along but don’t own these plugins, you can use WP All Import online sandbox. Just choose the ACF Fields option and click the Create Sandbox button.

Note, we’re only using the ACF Fields version of the sandbox because it happens to contain sample posts with multiple images, but the exact same techniques can be used for WordPress pages, users, etc., as well as any custom post types.

Step 1. Select Posts

select posts to export images in wordpress

To export images with their associated posts, go to All Export > New Export and select Posts.

Step 2. Expand the Add Filtering Options Panel

add rule to export images in wordpress

If you want to export specific posts, expand the panel above the blue buttons. To create a filter rule, you must select or provide an Element, Rule, and Value. In this case, we’re asking to export posts with the word “day” in the title (most of these are movie titles).

To apply the filter, you would normally just click the Add Rule button. You can also repeat this process to add as many filter rules as you wish.

However, in this case, we’re going to skip this step and export all posts.

Step 3. Choose the Data

drag and drop to export images in wordpress

After you click the Customize Export File button, you will see the Drag & Drop screen.

This screen is where you choose the data columns to include in your export. The available fields are displayed in the Available Data panel on the right. These fields are organized into subsections, which you can expand or collapse as you wish.

The image data is in the Media > Images subsection. This includes everything that you would expect for images in portfolio website builders such as WordPress:

  • URL
  • Filename
  • Path
  • ID
  • Title
  • Caption
  • Description
  • Alt Text
  • Featured

To include a field in your export, just drag and drop it into the column selection area. Alternatively, you can select all the fields in a subsection by dragging and dropping its All element, as we have done in this example.

Step 4. Choose the Export Settings

choose the settings to export images in wordpress

Once you’ve selected the Images fields, click the Continue button. This will bring you to the Export Settings screen.

There are a number of scheduling and advanced options on this screen, but let’s skip over these for now and click the Save & Run Export button at the bottom.

Step 5. Download a CSV File

complete export screen in wordpress

Click the CSV button. You can change the export type to XML or Excel earlier in the process; the label for this button will change accordingly.

Note: the single post titled “The Man Who Loved Yngve” in the above image has multiple image URLs associated with it, each separated by a pipe (“I”) character.

export multiple images in wordpress

If you edit this post and scroll down to the Example Group section, you will see that it does indeed have four images associated with it, albeit “dummy” images.

post images example in wordpress

Whether one post has four images and another has two, etc., won’t matter. They’ll just be exported with the designated separator between them, as shown in the sample data.

You can also change this separator. Back in the Drag & Drop screen, double-click the Image URL field to open up the Edit Export Field form.

change the separator to export images in wordpress

Note how this WordPress plugin for blogs, ecommerce and corporate websites recognizes that this is an image-related field and gives you not only the option to change the separator but also whether you want to export just the featured image, attached images, or both.

Importing WordPress Posts with Images

Unfortunately, importing images with WP All Import/Export plugins is not quite as simple.

Step 1. Start with the New Import

click new import to import images in wordpress

Go to All Import > New Import. Then upload a file. For this example, upload the file that you just exported.

Select Posts as the post type and click Continue to Step 2.

Step 2. View a Post

view a post to import images in wordpress

This brings you to the Review Import File screen. Because the first post in our export is the “Hello World” post, which doesn’t have any images, click the gray navigation button in the upper-right quadrant of this screen to view a post with image data.

Most times, you don’t have to take any actions on this screen. Its purpose is to verify that the import file has been correctly interpreted. Because it appears to have done so, simply click the Continue to Step 3 button.

Step 3. Name Your Incoming Data

name your data to import images in wordpress

This brings us to the import version of the Drag & Drop screen. The main purpose of this screen is to let you tell WP All Import how to map the incoming data elements in the import file to the target database fields in WordPress. As you can see above, we have mapped the incoming title data element to the Title field, and the incoming content element to the Content field.

Don’t be reassured by how well the names of the incoming data elements match the names of the target fields. That’s because we’re importing data that we just exported from WordPress.

If you receive an import file from a non-WordPress data source, the names of the incoming data elements could be anything, so you will need sufficient knowledge of that file’s structure to perform an import.

Step 4. Discover the Images Panel

discover the images panel to import images in wordpress

In this particular case, we are more interested in mapping image data, so collapse the Title & Content panel and expand the Images panel shown at the bottom of the preceding image.

The challenge here is not the mapping part, which involves only the image URL data element. It’s configuring the settings. Let’s walk through them one by one.

In the top section, you have three choices for the source of your images:

  • Download images hosted elsewhere. This is what we’re using in this example because our images are all identified by URL, even if that URL originates from the same sandbox.
  • Use images currently in Media Library. If you use this option, you are expected to supply just the filenames, i.e., no URL prefix, because WP All Import will use those names to look up the images already in the Media Library and then link them to the incoming post.
  • Use images currently uploaded in…, with the … being whatever folder is designated as the upload files folder for your WordPress installation.

This covers all your possible image sources because you’re either importing images from another server or they’re already on your server in one form or another.

The Image Options section contains the following settings:

  • Search through the Media Library for existing images before importing new images. This setting is designed to avoid creating duplicate images if those images already exist in your Media Library. You don’t need to use any third-party duplicate photo finders.
  • Keep Images currently in the Media Library. This governs image updates for existing posts. Let’s say that you are importing a post that already exists and has the same three images. If you leave this option checked, the existing images will remain as they are, and the import images will be ignored. If you uncheck this, the plugin will delete your existing images and replace them with the imported images. This lets you handle situations where some incoming images have the same file names or URLs but have been changed in some other way.
  • Scan through post content and import images wrapped in img tags. This addresses the situation where images are embedded in a post using img tags. WP All Import will automatically download the image (so long as it is accessible), load it into the Media Library, and update the tag with the new URL.
  • Set the first image to the Featured Image (_thumbnail_id).
  • If no images are downloaded successfully, create entry as Draft.

Step 5. Fill in the Remaining Fields

fill in fields to import images in wordpress

The rest of the image fields are addressed in the SEO & Advanced Options section at the bottom of the Images panel. To fill them out, you may need SEO software or other tools.

Importing a Variable Number of Images

import multiple images in wordpress

As long as an import file uses one data element to store its images and a consistent character to separate multiple images, it won’t matter if a post has zero, two, or many images.

However, that’s not the only way to store multiple images per post. What happens if image URLs are stored in multiple incoming data elements, typically one image per element? Fortunately, WP All Import will ignore any blank values, so you can just map all the image URL elements to the same target field and let the plugin sort it out.

What if your import file is an XML file that stores image URLs as child elements of a parent element? WP All Import has some code snippets to loop through that kind of structure and parse out individual images.

Bulk Editing WordPress Image Data

If you need to change the Alt Text fields for hundreds of images, you can, of course, do this one by one through the WordPress interface. But if you’re going to be making similar changes to groups of images, it would be much easier to do this in a spreadsheet, where you can use search-and-replace, copy-and-paste, etc.

This by itself is not challenging. You can easily open a CSV file in any spreadsheet software. The challenge is getting the changed data back into WordPress by correctly mapping the fields and configuring the import options. Fortunately, WP All Export records your previous exports and then gives you the opportunity to re-import the same file, changed or not.

bulk editing wordpress image data

Step 1. When you click the Import with WP All Import option on the right, you are immediately thrown into the New Import screen.

upload a file for bulk editing wordpress image data

You still must select your import file (in case you changed the name), but the structure of that file is presumed to be the same as the structure of the export file. Click Continue to Step 2.

Step 2. Clicking Continue to Step 2 not only throws you immediately into the import Drag & Drop screen. It also creates all your import mappings for you.

import mappings for bulk editing wordpress image data

From this point, you can just hit the various Continue buttons until your import is complete, and your changes will be automatically applied.

Migrating Images from One WordPress Website to Another

migrate images in wordpress

The ability of WP All Import to understand the structure, mappings, and settings of an export file is not limited to the bulk edit process. WordPress developers and other experts can use this same feature when migrating images from one WordPress website to another.

All you need to do is choose the Bundle option instead of a CSV (or Excel or XML) file from the source site.

In addition to the export data, the bundle file includes an import template that contains all the mappings and settings that WP All Import needs to import the data into another WordPress site.


Ann Young

Hi there, I'm Ann Young - a professional blogger, read more

SAVE UP TO 60% OFF SAVE UP TO 60% OFF