The Handiest WordPress Plugin You've Never Heard Of

WordPress Toolbox

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.

Real-Time Find and Replace Interface

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>/

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:

<span class="bio-title"></span>

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:

/<img(.*)?gravatar\.com\/avatar(.*)[/php]/

As an added bonus, removing all of these Gravatar calls reduces page load time.

5. I use the Digg Digg plugin for displaying social media buttons. This plugin injects an unnecessary call to a big JavaScript file that just slows down the page. I remove it from the HTML code using this regex rule:

/<script(.*)?sharethis\.com\/button\/buttons\.js(.*)?<\/script>/

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.

7. The Digg Digg plugin (mentioned above) calls a JavaScript file well above the closing body tag of the page. To help with fixing a problem related to Facebook generating pages by appending a parameter (see this discussion on the fb_xd_fragment problem) to my URLs I need to remove this JavaScript call so I can manually add it to footer.php in the right place. I remove this code with this replace rule:

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>

Is it possible after these 7 examples there still isn't even one possible use for your site?

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...Loading...

27 Comments

  1. Hi. This plugin is great, but I do have a question. I am trying to find and replace a lot of data, is there anyway to copy in a lot of data without having to do it one by one in the plugin backend as provided. I have numbers that need to be replaced with updated numbers, I am looking for a quick way to make this change. Thanks,

    • That functionality doesn't exist at this time. Your only option is to insert the necessary fields directly into the WordPress database for the plugin to use. Marios

      • Hi Thanks for the quick response. I'm not quite sure I understand your response....Are you saying there is a way I could do this by inserting the necessary fields into the WordPress database for the plugin? Or do you mean the only way is to insert the items one-by-one into the plugin?

        • You could write SQL queries to insert the data into the WordPress database in the same way the plugin does. Sometimes that can be pretty quick work, but it'll depend on how familiar you are with SQL.

        • Thanks Marios, Unfortuneately I do not know how to do the SQL stuff, but I will keep looking into ways to get this done. Thanks, Plugin is awesome!

  2. hello, is it possible to add a variable to a url with your plugin? example: test.com/fixed/random/random to test.com/fixed/samerandomasabove/samerandomasabove?variable=mysite.com regards

    • If you're trying to add a variable that changes, then no.

      • sorry, i wrote it wrong, i meant ?site=mysite.com and it is fixed, those that change every time are the "random" parts. i need to add ?site=mysite.com to every new link from test.com. I tried a regexp but of i screwed, the resulting post became blank :) Thanks for the replay btw

  3. Hi, Marios... [I posted this in the support forum, but I thought I would also post it here.] This plugin could be a miracle saver for me, as it's a brilliant plugin! I just installed it, but it doesn't seem to working. I have no cache plugin installed, and I've tried clearing the cache in my browser. I've tried replacing html that is being rendered by js and also simple text replacements contained in a post, but no changes are occurring. Does Real-Time Find and Replace v2.0 work with WordPress v3.9? I would really appreciate your help... :) jonathan

    • Hi Jonathan, I just tried the plugin with WP 3.9 and it seems to work. It sounds like you are doing things correctly, but just to confirm if you "view source" is the text you're trying to replace visible? The plugin requires the content to actually be in the source.

  4. Is there any permanent replacement?

    • No the changes are made when the page renders. They can't be permanent because the code being replace might not actually exist until the page is created. If you want to make permanent changes to content, look up the Search RegEx plugin.

  5. Hi, I really like your plugin, it's the only search and replace plugin that i found that meets my requirements: -replaces the meta parameters as well -replaces terms right before the post is published. I was wondering ...is there any way to make the search and replace changes permanent not just passive? On my website works fine just as it is, but if i connect wp to google+ ,the posts imported to g+ includes the deleted string. Ofcourse the string doesn't appear on my website only on g+.Any idea how to solve this problem? Thanks for your time.

  6. Hi Marios Just a comment/question on this plugin´s use you may have not thought about I do have few afiliates programes runing right now on my site. Plugins like "ad inject" do a great job into inserting the ads i like, but it does it on all site´s pages and posts. Not practical. What i need is to keep track of what each campain is doing in wich part of site in order to keep the best ones running. Im thinking of placing manually all ads in the areas i need them to be placed. Then Real-Time Find and Replace plugin could just replace each ad code by areas, leaving in each area the right ad. I will need to run test first but I think itll work just fine. Rgds

  7. I am simply trying to remove Category Archives off my blog. I'm on wordpress 3.8.1. I've used the commands >Category Archives: < It hasn't changed anything on my site, the Category Archives title is still there. Am I missing something? Thank you

    • That seems straight-forward enough and it should work. Have you tried taking the text you're searching for, viewing the source of the page, and then searching for it using the browser's search feature? Just to confirm that it's appearing in the page in the expected way.

  8. Hello, I recently imported 112 posts from Hubspot into WordPress, which worked nearly flawlessly except it included some strange character entities that I need to replace. For example, the word didn't uses \'92 for the apostrophe: didn\'92t Obviously, I'd like to replace it with the proper character entity such as ' I installed the plugin, but it didn't work therefore I'm probably overlooking something so does anyone have a suggestion? Thanks in advance, Mario

    • The plugin should be able to handle what you're describing. You shouldn't need to use the regex functionality either. So a simple find and then a replace with what you've specific should work. You're not looking at a cached version of the page, are you? If you've got WP Super Cache or W3 Total Cache then you need to flush the cache or configure it to not cache for your ID. If that isn't the case then I'd double-check that what you've provided for the find is correct. For example, is the quote a straight quote or curly quote. It's not always obvious from looking so I prefer to copy from the source and paste into the plugin. I hope that helps!

  9. Cool plugin, but how to replace the path to the images? I like the website address http://site.com/wp-content/uploads/year/month/ and I want to replace it at this http://site1.com/uploads/year/month/ to year and month - themselves replaced, you know?

    • I'm not sure I'm understanding your question, but it seems like you just need to search for: site.com/wp-content/uploads/year/month/ And replace with: site1.com/uploads/year/month/ You'll need to use regular expressions to match the year and month since they're going to change all of the time. For example, you could match a year with [0-9][0-9][0-9][0-9].

  10. It seems that after WordPress upgrade to the lates versio WP 3.6, the plugin stop functioning,

    • Thanks for the heads up. I usually don't upgrade to the latest WordPress until they release the .1 of any version so that I don't have to deal with the initial bugs that are typically associated with a new version. As soon as I do I'll be checking out how the plugin works.

    • I found some jQuery incompatibilities and I believe I have corrected them. The latest version (1.5) should work as expected.

  11. I am using a wordpress theme for a real estate website but it has $ all over it and as im in the UK i need it to be £ so I have installed the Real-Time Find and Replace plugin which replaces it in some locations but not when the search runs. I guess this is due to the fact that the search results are populated after the search and replace is completed. Any ideas how i can get around this? Much appreciated. Dan

    • The search and replace functionality works for the search results on this site. Are your search results perhaps coming from a third-party source via JavaScript. One way to check this is to view the source of the web page and confirm that the text appears in the source code. If not, then this plugin won't be able to replace text.

      • Yeah they are coming from a third party site, which is both good and bad. I am guessing there is no way of re-running the search and replace within the JavaScript search code? Cheers Dan

        • There may be a way, but every third-party does something different so there's no way for me to know. Often third-parties provide other ways to access their data which allows you manipulate it before displaying it (usually referred to as an API), but then the onus is on you to take care of displaying the data properly.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current ye@r *