If you're a WordPress developer, chances are from time to time, you just want a…
All in all, WordPress offers a pretty robust media manager. It’s fairly simple to add new images, tag assets and customize crop thumbnails, all from within the media manager. But it’s not so easy to replace an image that you’ve already uploaded. The only way to do it is to delete your current image and upload a new one. If you manage a site with a lot of posts, this just isn’t a scalable solution. Enable Media Replace makes it happen.
What’s It Do?
With Enable Media Replace, you can replace files that are already on your site through the media library. When you replace an asset, you will have two choices. You can either
- Just replace the file, or
- Replace the file, use new file name and update all links
The first option will work by renaming the file you are uploading to the exact name of the already uploaded file, that way it is replaced directly on the server. The only condition for this is that the asset you are replacing must be the same format as the asset you are uploading (JPGs replace JPGs, etc.). The second will use an entirely new name and file path, and then go through your WordPress site and replace all of the links associated with that image.
How’s It Work?
Enable Media Replace is one of those plugins without any settings. It just works once you activate it.
To use it, go to your Media Library by clicking Media -> Library in your admin panel. This has a list of every asset on your site, from images to documents. If you hover over the assets, you will see a new option entitled “Replace Media.” Click on this to replace your content.
On the replace screen, you will see two options. As mentioned above “Just replace the media” will switch out your old image with the image you are uploading, renaming the file in the process so that links stay consistent. In order for this to work properly, you must upload a file with the same file extension. If you try to upload a file in a different format, the replacement simply will not work.
The second option will “Replace the file, use new file name and update all links.” This should be used if you need to upload an asset in a different file format. This will replace the file, but keep the newly uploaded asset’s filename. Instead of replacing the file directly on the server, the plugin will then filter through your posts and replace any links you have pointing to the old file and replace it with the filename of the new asset. There are some potential pitfalls here that I can think of, such as the filter not reaching your post if it is hidden within custom post types or complex taxonomies, but in my testing, I didn’t find any problems even when this was the case.
Costs, Caveats, Etc.
Enable Media Replace is a simple, and free plugin. Måns updates the plugin when new updates to the WordPress media manager comes around, so you can be sure it will be up to date. Also, he is very active on WordPress’ support forums for the plugin, so be sure to go there if you are running into some trouble. Other then that, it’s pretty much set it and forget it.
- Måns Jonasson’s Website
- Support Forums
- Bit of a dated, but still relevant post on WPHub
- Enable Media Replace on a ManageWP Top 10 List