You undoubtedly had to replace an image you uploaded to WordPress in the past. After all, images are a crucial part of multimedia and, by proxy, websites created in WordPress and any other CMS (Content Management System). We bet you tried the logical route — delete an old image, upload a new one with an identical name, then apply it in place of the old. That is certainly possible through the power of the WordPress Media Library. However, it comes with several downsides we’ll go over in a moment. Now, let’s dive into how to replace an image in WordPress.
Drawbacks to manual image replacement in WordPress
Before you decide on the method, here are some cons of manually replacing images on your website:
- Deleting an image before uploading one with the same file name can lead to the old thumbnail persisting. Alternatively, you may get an empty thumbnail
- Uploading a replacement image with a new file name means you lose all ranking the old achieved with search engines. To solve that, you must manually set a permanent redirect for every picture URL (Uniform Resource Locator)
- If you change the file name, you must manually hunt down all places the image appears on and update the URL. Even if you don’t, it’s imperative you double check replacement took place
- The procedure is tedious if the number of pictures is high, such as when rebranding
1. Replace an image in WordPress manually
Once again, this is only recommended in specific cases, such as when the number of image files is low. With that said, manually replacing images within WordPress, based on the approach, works like this:
1. Using WordPress Media Section
Start by accessing your WordPress Admin Section. Now, do the following:
Find an image you want to erase
Expand the sidebar on the left. Click on Media then Library below. There are two avenues you can take now:
- Stay in “Grid View” by default. You must click on each image item to see more options. When you do, pay attention to File name (such as my-old-image.jpg).
- Recommended. Click the “List View” icon in the top left corner. Images will be listed vertically and you can see details without clicking, like thumbnails, names, file types, and uploaders’ display names.
Delete the image and upload a new one
After remembering the exact file name, click the Delete Permanently link. After you confirm, the image will be deleted from the server, although not fully. Prepare your new image, and name it in one of two ways:
- Identically (old-file-name.jpg). This comes with consequences, namely with showing the old thumbnail, forcing you to clear the WordPress cache.
- Differently (new-file-name.jpg). This circumvents problems with caching and lets you change the file extension. However, it makes the step below mandatory. Plus, it eliminates any SEO (Search Engine Optimization) your old URL benefitted from, unless you set up a 301 redirect by hand.
Edit the Alternative Text (text shown in case image itself is unavailable) and Description. Optionally, add a Caption, i.e., the text below the image. Click outside the text fields and you’ll see a small “Saved.” notification.
Make changes to posts and pages
This shouldn’t be necessary if you opted to keep the file name. We also cannot know where the image was. Therefore, we can only demonstrate replacing an image in three common places on a WordPress website:
- Home page: In the Admin dashboard sidebar, click on Appearance > Customize. You’ll now see a Live Customizer with options on the left. You can also click on on-page elements, and, if your theme/page builder supports it, edit the URL straightaway.
- Featured image: Open a post or page. Look for the Set featured image link in the “Featured image” meta box (Classic Editor) or an option titled Featured Image (Block Editor). Click the existing image, then select a new one from the Media Library.
- In-text image: Click the picture in the text. Select the pen icon, then Replace. Pick “Media Library,” then your image. If that doesn’t work, click the X icon (Classic Editor) or the three-dot menu > Remove Block (Block Editor). Insert your newly uploaded picture.
2. Via FTP (File Transfer Protocol)
Replacing images after accessing your website via FTP is not something we recommend. Only do so in rare cases, such as when you’re locked out of WordPress. With that in mind, do this:
- Access your WordPress website using FTP.
- Head to the public_html/wp-content/uploads/ folder.
- Look for the image you want to replace. Select it and click the Delete button in the top menu.
- Upload a new image, following the same guidelines we mentioned under “Delete an image file and upload a new one”.
If you opt for the same file name, you likely need to fix blank thumbnails in WordPress Media Library afterward.
2. Replace an image via a WordPress plugin
Unsurprisingly, this issue can be resolved after installing a suitable WordPress plugin. Although we have no ties to the developers, this one is a popular choice at this time:
Follow these steps to replace an image using a WordPress plugin:
- After activating Enable Media Replace, head to your Media Library.
- Select the image you seek to exchange and click the newly added Upload a new file button.
- Optional. If you switch to List View, you’ll notice a new link, Replace Media, under every image item.
- You will be taken to a “Replace Media Upload” page, with your old image and its resolution displayed in the bottom left corner.
- Click the Choose File button and select a new image.
- The image you choose can have:
- Any file name. If you select Just replace the file under “Replacement Options”, the plugin will automatically assign it the same name. Thus, the name of the uploaded file is irrelevant. In this case, the file extensions must match.
- A new file name: If you select Replace the file, use new file name, and update all links, the plugin will use the file name of the uploaded picture. You can use a different file extension, and the plugin will configure a permanent redirect.
- Under “Date Options”, select the date assigned to the new picture: current, original upload, or custom.
- Click the Upload button, and the plugin will automatically replace all instances of the old image across your website.