Real-Time Find and Replace for WordPress
This plugin allows you to dynamically (i.e. at the time when a page is generated) replace code and text from themes and other plugins with code and text of your choosing before a page is delivered to a user's browser.
Because the find and replace happens in real-time no changes are needed to plugins or themes which means upgrades remain easy!
Here are some examples:
- Don't like the "Category:" text that the Dagon Design Sitemap plugin puts in front of every category? Remove it!
- Annoyed by the link that Global Translator adds to every page? Remove it!
- Have you noticed that the Sociable plugin doesn't correctly display the Twitter image? No problem, insert it!
- Don't like the link that the Photodropper plugin inserts with every image? It's out of there!
And remember, all of the above can be done WITHOUT modifying themes or plugin files so you'll always be able to upgrade them without having to worry about losing custom edits.
Special thanks to Aaron Waggener for providing the technical brains behind this plugin!
There are some WordPress plugins out that are incredibly helpful, but because they don't solve a specific, well-defined problem they don't get noticed. Take for example the Search RegEx plugin which is indispensable if you're moving or updating a site. But this plugin has been downloaded just 20,000 times and I know there are more people out there that could use it.
Another super-helpful one is the Real-Time Find and Replace plugin which replaces code or text in the final, outputted HTML i.e. after a page has been rendered. I think the problem is that this plugin is so generic in nature that no one knows how to use it. To help the situation I'm going to describe how I use it. Not a bunch of theoretical uses, but actual ones in place on this site right now.
First of all, the interface (shown below) is pretty straightforward. On the left is where you specify what to search for. On the right is what, if anything, you want to replace it with. And in the middle you can indicate whether you're specifying a standard rule or a regular expression i.e. with pattern matching.
1. Have you ever noticed that Google is picking up multiple versions of your pages with different replytocom parameters? This can result in a lot of duplicate content. There are have been a bunch of suggestions on how to fix this including redirects, disallow entries in your robots.txt file, and dynamic parameter settings in Google Webmaster Tools. With the Real-Time Find and Replace plugin you can keep Google from finding these URLs entirely while still keeping the commenting functionality. Just add this rule:
?replytocom= replaced with #replytocom=
Pretty sweet, right? Now the duplicate URLs don't even exist so you don't have to block them and you won't lose link equity.
Note: This solution works perfectly on this site with this theme. I haven't tested it exhaustively with other themes so be sure to test our your comment form after implementing.
2. Sometimes I close comments on a page or post. I don't like having the text that reads "Comments are closed". I figure such a message is redundant since you can't enter a comment. To remove this I use this regex rule:
/<p class=\"nocomments\">(\s)*Comments are closed.(\s)*<\/p>/
Note: With regex rules you to need to start and end with a forward slash.
3. I use the Author Bio Widget, but it spits out a tag I don't use. I could modify the plugin to remove it, but that would mean that when I upgrade the plugin I'll lose the code update I made. So instead I use this rule:
4. I want Gravatar support on this site in some areas, but I hate having the same unknown icon displayed for commenters that don't have a Gravatar image and in my case that's most of them. To keep Gravatar support on while also eliminating the image I use this regex rule:
As an added bonus, removing all of these Gravatar calls reduces page load time.
6. The Photodropper Plugin outputs a link to an external site for every image it adds to a post. I think this is excessive so I remove the link with this rule:
<a href="http://www.photodropper.com/photos/">photo</a> which is replaced with just "photo"
Note this technique of removing links from plugins works everywhere. I've used it for a bunch of plugins.
Is it possible after these 7 examples there still isn't even one possible use for your site?
There is no cost to use this plugin, but donations of any amount are certainly appreciated and will help encourage continued improvement and support of this plugin. Priority support will be given to those that have contributed. Thanks!