Replace images in WordPress media library and update links

Easy way to replace or update images in WordPress websites

An Apple MacBook with a website on the screen

Sometimes you need to replace an image that you have used on your WordPress website or blog. How do you do that when it is used across multiple posts and pages? With a plugin of course.

If an image is used just once in one page or post on your website, you can easily open that page or post, click the image in the WordPress editor and replace it with a different image, either from your media library or one you upload. There are no problems with this and it is just a two minute job if you have the new image ready.

The problem is that some images are used across multiple pages, such as a brand or website logo or images that contain a brand or logo. There may be multiple instances of a picture of yourself. You might rename your site and call it something else. A product may change and you need to update all instances of the photo to show the new product.

A picture that shows something common might be used on multiple posts and pages and that two minute job can become an all-day nightmare as you try to track down all the posts and pages that an image is used on on your site and replace each occurrence with an updated one.

Wouldn’t it be useful if there was a simple way to replace an image everywhere it is used on your WordPress site with a new image? Well, there is a plugin for that and it is free and very good.

Enable Media Replace is a free plugin by ShortPixel, which is best known for the image optimizer plugin. In fact, both plugins can be used together, but here I just look at Enable Media Replace.

1 Install Enable Media Replace

Add a new plugin to WordPress

To install the plugin, click Plugins in the WordPress admin sidebar and then click the Add New button at the top.

Type Enable Media Replace into the search box and it appears in the search results. Click the Install Now button and when it has finished, click Activate.

There are no settings, no menus, no buttons to be seen anywhere. You might wonder if it has installed. Don’t worry, it has. Let’s see how to use it

2 Choose an image in Media library

The WordPress media library showing thumbnail images

To replace an image, click Media in the WordPress sidebar and then find the image you want to replace. You might need to use the search box or the dates menu to find the image if it was a long time ago. When it has been found, click it to open it.

3 View image details

Viewing an image file details in the WordPress media library

The details window appears and to the right of the image is the familiar information panel showing all the file details. Right down at the bottom is a new item that was not there before, Replace media. Click the button, Upload a new file.

4 Upload a new image

Using the Enable Media Replace WordPress plugin

A new window opens and it shows the original image and the dimensions in pixels. Either click the Choose File button or simply drag a file from the computer’s disk and drop it on this window to upload it.

Keep the dimensions of the new image the same or there could be layout issues if the replacement image is bigger or smaller. After adding a new image to replace the current one, both images are shown next to each other.

5 Image replacement options

Replace a media file in the WordPress media library

Below the old and new images are some options:

  • Just replace the file: This replaces the image, but not the filename. Nothing in WordPress needs updating because a link to this image will show the new one instead of the old one. However, you can only replace a .jpg with a .jpg and a .png with a .png. This is because the old filename remains the same and if the original is image.jpg the replacement is image.jpg.
  • Replace the file: This replaces the old image and filename with the new image and filename. The name and type can be different, so you can replace old-image.jpg with new-image.png for example. The plugin updates all posts that use the old filename with the new filename.

There are some date options and you can keep the old date of the image file or update it with the new image’s date. There could be benefits to updating the date and Google might see updated content, which helps SEO.

Replacing images is not something you do every day, but if you ever need to do it, this plugin can save you a lot of time and effort, replacing all occurrences of the image in all posts and pages.


Comment in the Forums Right pointing red arrow