WordPress – Bulk Replace Media Library Files and Keep URLs

In this tutorial, we will show you how to bulk replace Media Library files in WordPress, without breaking your URLs. You won’t have broken URLs on your WordPress posts or pages.

Sometimes, you need to change images or videos on your posts and images. However, that’s a big task because you’d have to open each post or page, and replace the file URLs manually.

Fortunately, there are tools like the Enable Media Replace plugin, which allows you to replace media library files without breaking URLs.

And here we’ll show you how to replace files in bulk, using an intuitive spreadsheet inside WordPress.

What you need to replace media library files in bulk

  • First, you need the new files. These are the files that will replace the old images, videos, etc.
  • Second, you need to install and activate the Enable Media Replace plugin on your WordPress site.
  • Third, you need the WP Sheet Editor plugin, which allows you to manage your products using a spreadsheet inside WordPress.

You can download the plugin here:

Download Media Library Spreadsheet Plugin - or - Check the features

After installing and activating both plugins, you can start replacing media library files using the spreadsheet.

Here are three ways you can do it:

1- Replace media library files using the spreadsheet

Open the spreadsheet by going to Sheet Editor > Edit Media.

You’ll see all your images, videos, documents, audios, etc. displayed in a spreadsheet.

media library spreadsheet wordpress

Now head to the Replace with this file column, where you can:

  • Upload files from your computer
  • Select other files from the Media Library
  • Paste a URLs

enable media replace wordpress

Once you add the files to the Replace with this file column, you can click on Save to apply the changes.

wordpress bulk replace files

This is a great way to save a lot of time because you can replace many files with a few clicks. You don’t need to open a lot of pages to replace images, videos, or other file formats.

2- Bulk replace files by importing a CSV file

You can replace a lot of files at once by importing a CSV file containing the file URLs in the Replace with this file column.

You need a CSV file containing the following columns:

  • ID
  • Replace with this file

You can use the Export tool that comes with WP Sheet Editor to get the CSV file containing the columns we’ve mentioned above.

Just click on the Export tool on the top toolbar, and then select the following values:

  • What columns do you want to export: ID, Replace with this file
  • Which rows do you want to export: All the rows from my current search
  • What app will you use to edit this file: Select the app you’ll use.
  • Click on Start new export

bulk-replace-files

This is what your CSV file should look like. As you see, we’ve already pasted the new URLs in the Replace with this file column.

Note – These new files must have been previously uploaded to your site so that you avoid any errors.

bulk-replace-files

Now you’re ready to start importing the CSV file, so click on Import.

wordpress bulk replace files

Now select the CSV file on your computer and click on Next.

import a csv file to replace files wordpress

Now we’ll match the files in the CSV file with the files on your server by ID.

Select record_id in the CSV Field, and ID in the WordPress Field.

Then click on Next.

import files in wordpress

Finally, you’ll see a preview of what the info will look once it’s imported into your site.

If everything is OK, click on The preview is fine, start import.

bulk-replace-files

After that, all your files will be replaced, and you won’t have broken URLs on your site.

3- Bulk replace many files at once

Another option to replace Media Library files is to use the Bulk Edit tool, which allows you to edit many files at once.

You can select all the files you will edit using the Search tool, the checkbox picker, or edit all the files.

Here’s how you can manually select the files you will replace:

media library spreadsheet select files

Now you can open the tool by clicking on Bulk Edit on the toolbar.

media library spreadsheet open bulk edit

Now select the following values to bulk replace the selected files:

  • Select the rows that you want to update: In this case, Edit the rows that I selected manually in the spreadsheet
  • What field do you want to edit: Replace with this file
  • Select type of edit: Set value
  • We will replace the existing media file with this file: Click on Upload the file or paste a URL in File URL
  • Click on Execute Now.

wordpress bulk replace files

With these values, you can replace many files with a specific file.

As you see, WP Sheet Editor allows you to bulk change Media Library files with a few clicks.

You can replace files using the spreadsheet, importing a CSV file, or using the Bulk Edit tool.

You can download the plugin here:

Download Media Library Spreadsheet Plugin - or - Check the features

Do you need help?

You can receive instant help in the live chat during business hours, or you can contact us and we will help you via email.