The Easy Way to Replace an Image in Wordpress
It's a rare website these days that doesn't use some sort of images. Whether its photos, logos, or other graphic elements, those image files can turn boring text into a much more engaging experience for the user.
But over time, stuff can happen. A logo can change or a graphic element that get's used time and again gets modified. Maybe you have a certification image that you received last year and used in various pages that has now been upgraded to feature the current year?
What's the best way to change out those images in Wordpress?
In the case of a logo, maybe the only place it's been used is the header and/or footer. In that case you can create an updated file, upload it to the media library and then go in a replace the image in the header and footer. Pretty simple right? But what if that logo was used referenced by the url and used elsewhere such as an author box on a guest post of another site? Or maybe it was referenced in another page that you'd forgotten about?
The same questions could be asked of the example above about the certification image. Who knows how many places that image might have been used?
There are some options. Let's explore them.
(S)FTP to Replace the Images
The (S)FTP option would be to FTP into the server and directly replace the image file. This method can be quick but can also be a little tricky. First you need to have (S)FTP access and know how to use it.
Another issue to consider is that Wordpress by default creates various image files (thumbnails) from the original file during the upload at different dimensions so that it can serve the optimal size as needed. Other themes and plugins can also create various versions as well. So to use this method you'd either need to upload those alternate sizes in addition to the original file or have Wordpress regenerate the other files after swapping in your updated image. There are different plugins you can use to regenerate those thumbnail images like Regenerate Thumbnails or Short Pixel's reGenerate Thumbnails Advanced.
Using a Plugin to Replace the Images
When using a plugin we are trusting that the plugin developer is crossing all the T's and dotting all the I's for us. But that's true anytime we use a Wordpress plugin and why we should always do our homework and check reviews prior to using them.
Using a Wordpress plugin in this case can save us time and make it much easier. As an example, Short Pixel's Enable Media Replace plugin can do more than just upload a replacement image. It offers 2 options:
- Just replace the file - This does what it says. Replaces the file using the same filename and url. The original image will be completely replaced.
- Replace the file, use new file name and update all links - This option will take a new file name and then replace all instances in your database of the old image with the new image using the new file name. Both image will still exist, each with their own name and url.
Final Word
Swapping out images while is sometimes necessary, it doesn't have to be difficult. Both of the methods above can get the job done and probably take you less time than it took me to type this blog post. As always it's a good idea to make a backup before making changes that are permanent.