How to Change any Image used in a WordPress Plugin without Editing the Plugin Itself

Say you’ve found a great plugin that you want to use, and everything’s working wonderfully except that the plugin author is using images in the plugin which you don’t like for whatever reason. Now you want to change them, but you don’t want to write sloppy CSS to override other styles, or edit the plugin’s files either, so updating the plugin won’t be an issue.

You can replace any image on your website, including those from WordPress Plugins, by simply making a quick edit to your .htaccess file.

Here’s an example using the excellent WP-PostRatings plugin by Lester Chan. In this example, I’ve configured the plugin (via it’s options in WP Admin) to show a simple thumbs up / down rating system. By setting those options, the plugin outputs the following HTML:


<div id="post-ratings-50">
     <img id="rating_50_1" src="https://yourwebsite.com/wp-content/plugins/wp-postratings/images/thumbs/rating_1_on.gif" alt="Vote This Post Down" title="Vote This Post Down" onmouseover="current_rating(50, 1, 'Vote This Post Down');" onmouseout="ratings_off(1, 0, 0);" onclick="rate_post();" onkeypress="rate_post();" style="cursor: pointer; border: 0px;">
     <img id="rating_50_2" src="https://yourwebsite.com/wp-content/plugins/wp-postratings/images/thumbs/rating_2_off.gif" alt="Vote This Post Up" title="Vote This Post Up" onmouseover="current_rating(50, 2, 'Vote This Post Up');" onmouseout="ratings_off(1, 0, 0);" onclick="rate_post();" onkeypress="rate_post();" style="cursor: pointer; border: 0px;">
<strong><em>50</em>%</strong>
</div>

Note the two <img> tags calling for his gif files. They didn’t really work for the design of my site, so I wanted to replace them with my own files. No problemo, El Barto. I can simply set up 301 Redirects in my .htaccess file and let the server take care of it for me, forever.

Open up your .htaccess file and use the following template to redirect any particular image to another.


Redirect 301 /wp-content/plugins/wp-postratings/images/thumbs/rating_1_on.gif http://yourwebsite.com/path-to-your-image/newimagename.png

And you’re good to go!

Up Next: About the WordPress "Settings" Section