Migrate the WordPress Media Library Between Websites

Things to keep in mind:

    • Every environment (infrastructure, software, etc.) is unique, so there’s no universal approach to configuring a solution.
    • Review and understand all available settings, configuring them to the best of your ability, while not blindly guessing.
    • If a specific setting isn’t mentioned, the defaults are acceptable, or the settings are self-explanatory to any skill level.

One of my clients wanted to completely rebuild their WordPress website, and bringing over almost 5,000 images was one of the required tasks. However, the import/export functionality built into WordPress is ineffective for this type of job, especially when you think each image needs to be “registered” with its corresponding post, which was also being brought over separately.

This guide shows how to move WordPress media files and re-register them in the Media Library database.

Key Takeaways

  • Use the Export Media Library plugin on the source site to download your WordPress uploads as a zip file.
  • Upload the extracted contents of the uploads folders (by year) to the target site (/wp-content/uploads/) using FTP (like FileZilla) or a file manager plugin.
  • Use the Media Sync plugin on the target site to scan files and import them; this registers the files in the WordPress Media Library database.
  • Always take a full backup of both sites before you start, so you can roll back if needed.
  • After Media Sync finishes, your images appear in the Media Library, and migrated posts can attach to those images.

Step-By-Step Media Library Migration

What You Need

  • Admin access to both sites
  • FTP access or file manager plugin
  • Two media sync plugins
  • Enough local disk space to accomodated the downloaded zip file

Source Website

  1. Create a full backup of your website
  2. Install and activate the Export Media Library plugin (Free) on the source website
  3. WordPress Dashboard > Media > Export
  4. Folder Structure > Nested folders
  5. Click Download Zip
  6. After downloading the zip file, proceed to extract its contents onto your local workstation

Upload Media Using FileZilla

Using an FTP application like FileZilla (free) or a WordPress plugin like File Manager (free), you want to upload each folder from your extracted files, one by one, choosing to overwrite the destination when/if prompted.

  1. Add your site to FileZilla and connect to it
  2. In the right pane of FileZilla, browse to the media library (/public/wp-content/uploads/)
  3. In the left pane of FileZilla, browse to the location of your extracted files
  4. In the right pane of FileZilla, browse to the media library (/public/wp-content/uploads/)
  5. Drag the folder for each year from the left pane to the right pane (Note: Choose to overwrite the files when/if prompted.)
  6. Repeat the above steps until each folder year has been copied over

Target Website

This is the server we are migrating your images to. Once your images are copied to the server, we need to sync them with your database, pulling them into your WordPress Media Library and thus making them available to your website.

  1. Create a full backup of your website (Note: Before starting any work on your website, it’s good to create backups so you can always undo your work if needed.)
  2. Install and activate the Media Sync (free) plugin on the target website
  3. WordPress Dashboard > Media > Media Sync
  4. Click Scan Files
  5. Uncheck Dry Run
  6. Select all of the folders that you uploaded
  7. Click Import Selected

After the sync completes, your media library will be available on your website, and any posts that migrate over will have their images attached.

Frequently Asked Questions About Migrating the WordPress Media Library Between Websites

What Is the Fastest Way to Migrate the WordPress Media Library Between Websites?

Export the uploads folder contents from the source site, uploading to the target site (/wp-content/uploads/), then run a media sync tool to register the files in the database. This avoids relying on WordPress import-export for thousands of images.

Why Doesn’t WordPress Import/Export Work Well for Moving Lots of Images?

WordPress import-export often misses the file registration side of media and can struggle at large volumes. Each image needs to exist on the server and be registered in the database to show in the Media Library and attach to posts.

Where is the WordPress Media Library Stored on the Server?

Most WordPress sites store media files in /wp-content/uploads/, usually organized by year and month folders. When you migrate, you want that same folder structure copied to the new server.

How Do We Register Uploaded Images So They Show Up in the Media Library?

On the target site, install and run the Media Sync plugin. Use Scan Files, turn off Dry Run, select the uploaded folders, and then import. This creates the Media Library entries for files that already exist on the server.

Should We Back Up Both Sites Before Migrating Images?

Yes. Take a full backup of the source and target sites first. If something goes wrong, backups let you restore files and the database without guessing what changed.

Share Post

403 Exclusive Deals

No Affiliation. Just Significant Deals on Premium Solutions.

Exclusive Giveaways

Effortless Entry. No Purchase Required.

IWP Newsletter

No Affiliate Links. No Ads. No Spam. Just Good Stuff.

Our newsletter dares to be different.