Real-Time Find and Replace for WordPress

Magnifying Glass


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:

  1. Are plugins inserting redundant JavaScript files such as multiple versions of jQuery? Get rid of all but one!
  2. Don't like the "Category:" text that the Dagon Design Sitemap plugin puts in front of every category? Remove it!
  3. Annoyed by the link that Global Translator adds to every page? Remove it!
  4. Have you noticed that the Sociable plugin doesn't correctly display the Twitter image? No problem, insert it!
  5. 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.

Download the plugin here.

Special thanks to Aaron Waggener for providing the technical brains behind this plugin!

Real-World Examples

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

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:

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


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:


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="">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=""></script>

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


If you've come from the donate link on I'm not actually looking for a monetary donation. I would love it if you were to Like, Tweet, or +1 this page though!

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 4.80 out of 5)


  1. Hi, Marios! The Real Time Find and Replace plugin doesn't appear to work on WP 4.0 Benny. I reported this over on the support forum for the plugin, but I thought I'd also come here, just in case you're not getting notifications from over there. I do hope you're still maintaining it! It's exactly what I need, and I'm so disappointed it isn't working for me. Thank you for the good work on the plugin, so far, even if you're no longer supporting it. :-)

    • Hi Melynda, Thanks for letting me know. Two things in response: 1) Every new release of WordPress brings with it reports that this plugin doesn't work. Every time the issue turns out to not be related to the new release. Yes, it's possible that this time it is related, but I'd explore other explanations too. Common problems include caching and rules the function unexpectedly. I'm happy to help you look into possible issues with your site if you can share more info. 2) I don't update to any "dot zero" releases of WP. I always wait for the "dot one" release e.g. 4.1. I don't have the time to deal with the inevitable bugs that come with a major release. No slight is intended for all of the great WP Core developers; it's just reality. So I haven't tested the plugin yet. I will as soon as WP 4.1 is out. Sorry, that's probably not what you wanted to hear!

      • Hi, Marios! No slight taken! I completely understand about not wanting to fiddle with the plugin between major updates of WP. I'm amazed that you spend time to support and maintain your plugins at all, with no compensation. This plugin, if I can get it to work for me, will be incredibly useful, and I'll be very happy to help you spread the word about it. Now then. Speaking of making it work for me ... ;-) I have absolutely no idea why it's not functioning properly for me. Perhaps I'm simply not using it properly, or perhaps there's a plugin conflict. I'm not using a caching plugin. I do have one installed, but not it's not network activated. I have a WP multisite install. Could that be the problem? Do you have suggestions about how I might go about troubleshooting? I don't know where to start, beyond trying a different theme and disabling my other plugins one-at-a-time and retrying Real-Time Find and Replace between each. Admittedly, I'm a noob, but I'm not afraid of getting my hands dirty, and I can learn ... Any ideas? Or can you point me in the right direction and give me a push? Thank you, by the bye. I'm absolutely thrilled to have received a reply from you. Amazed and grateful and humbled, too. Yours, --Melynda

        • Ooo...forgot to ask: You'd written, "I'm happy to help you look into possible issues with your site if you can share more info." I'm in! What information about my site do you need?

        • Hi Melynda, You have good timing! Just this morning I upgraded to WP 4.0.1 and I can confirm the plugin continues to work. So that takes care of one variable. This might be a multisite problem, but I don't run multisite so I can't confirm. The first test I would try is removing all rules except for a very simple one. For example, pick a piece of text from your menu or footer. Make sure the text exists in the source code without any HTML tags within it. For example, if somewhere on your site you have the word "RSS" use that in Find box and in the Replace box write "RSS2" (no quotes in either case). Save the change using the Update Settings button and then reload the page on your site. Marios

  2. Marios, Thank you for the great plugin. I downloaded it and used it successfully. Worked great. I would like to donate to your plugin. How do I do this? Thanks, Terry

    • Hi Terry, I'm glad you like the plugin. I don't really collect donations, but I appreciate the offer. Spreading the word about the plugin would be the best way to say thanks :-) Marios

  3. Hi, This plugin is great, but I do have a question? Is there anyway to upload a list of changes to the plugin rather than having to input them each one by one. Example: I have a large excel file, and if a respective sequence of numbers is on a page, then it needs to be replaced with a correlating item. Is there anyway to copy and paste multiple find and replace items in one action, or does each have to be input separately? Thanks,

    • Sorry, but there's no functionality for importing settings. You could try updating the field(s) directly in the WordPress database.

  4. Hi . thank you for your very very useful plugin . but I have a small problem with this plugin . when I setting this plugin to this setting : find : download replace : /// strong /// download /// /strong /// this plugin work good but titles word too, replace with same : Real time software /// strong /// download /// /strong /// by my web and this not good for my site . please help me to filtering this plugin only for post. // =>> thank you . Haider

    • What you're trying to do should work. When something isn't work for me, I copy the find rule to the clipboard, then view the source of the page I expect to be modified, and then search for what's in the clipboard. This helps ensure that the find rule matches what's in the source code because even small differences will result in failure.

      • My friend this plugin work for me very well . i want to bold a word with strong source code but this plugin added HTML code in title and strong or bold code any time can't work in title . but this plugin in the post and other position work very well . please help me for solve this problem and able to filtering the positions .

        • Unfortunately there are no additional filtering options to tell the plugin to ignore titles or other parts of the page. It may be possible to write the find rule as a regular expression that won't match the title, but will still match other parts of the page. Regular expressions can be tricky though so I'm not 100% sure there's a solution for your particular case.

  5. When you add mulitple keywords to list and save, it doesn't works. Only the last keyword is saved and others get deleted. Plugin only saves if you add one keyword at a time and have to update everytime before adding new one. Please fix the error. Thanks.

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

  6. The plugin doesn't work anymore. None of the pages loaded after adding a replace entry in the plugin settings.

    • The plugin continues to work fine for me. I've got many rules including regex replaces. I would suggest reviewing the rule you put in to make sure it isn't behaving unexpectedly. Maybe even start with a very a simple rule and build from there. I've also heard that some other plugins cause conflicts so if you've installed anything recently that could be the problem.

    • It doesn't work with wordpress 3.9.1 is there ay plans to update it?

      • I'm not aware of any problems with the plugin on WP 3.9.1. The plugin is used on this site which is running 3.9.1 and it is replacing text as expected.

        • Any ideas why it won't work on my site? it should be replacing the background from to and nothing seems to happen...

        • The from and to parts didn't come through. Were they HTML?

        • Yes they we HTML coding

        • i still have the same problem after updating to the latest version of your pluggin, here is a tinypaste so you can look at what i need to replace the webpage is could you advice on how to fix this? thanks in advance for all your patience

        • Take another look at your source code. I see that the page uses single quotes in that div tag and not double quotes like your find rule. When looking at the source be sure you're not using a tool that "cleans" the code as you need to search for exactly what's in the source. I hope that fixes the problem!

  7. Hi Marios, the Real-Time Search and Replace plugin definitely doesn't work with the latest version of WordPress (3.5). After much experimenting, I found out that I had to downgrade to WordPress 3.1 and Contact Form 2.4.6 in order for the plugin to work properly. Obviously this is not ideal due to the inherent bugs and instability of the older versions. If you have a chance to debug the plugin, that would be great. It does the job beautifully but needs to catch up with the latest WordPress and Contact Form versions. Thanks!

    • The plugin continues to work fine for me with the latest WordPress -- I'm on 3.5.2. I don't use Contact Form 2.4.6 though.

    • It also stopped working for me after setting multisite version in 3.5

      • Sorry, but the plugin hasn't been tested on any version of WPMU. If it worked in the past, it was just lucky.

  8. Hello, The plugin had worked very well for a long time, however, today I was not able to Remove old entries. Instead it adds empty entries. Wilfredo

    • I'm seeing the same thing. As far as I can tell nothing actually breaks. You just can't remove the boxes. They can still be emptied and you can put other rules into them. Regardless, I'll be looking into the issue.

  9. Great plugin however the Regular expression doesn't work on WP 3.4.1 I have tried examples from this website to make sure the expression if correctly formated and nothing works. It returns a white page when I try to render my site. Ideas?

    • The plugin works fine for me under WordPress 3.4. I can't imagine the changes in 3.4.1 were significant enough to break the plugin. Could you post one of the regex expressions here i.e. copy and paste exactly what you're using?

      • Here is the regular expression code I am testing with. This was taken from your site so I assume it's correct. Thanks for your help. /<meta name="generator" content="WordPress [0-9].[0-9].[0-9]" />/

        • I just tested the plugin and regular expressions are working for me. I tried an easy one where I replaced /generator/ with nothing. Things to keep in mind as it is hard to tell from the code you're pasting in as it gets modified in the comments... 1. Start and end the search box with a forward slash i.e. / 2. Be sure to escape special characters such as periods and forward slashes i.e. if you want to search for a period you need to type in backslash period. 3. Watch out for line breaks in your code. On this site the meta name generator spans two lines so the regularly expression you provided won't work since there's nothing in it to account for the line break.

  10. Would this work on multisite? Would I have to network install it? Say if I wanted to get change wp-admin in all urls to site-admin, how would I do that?

    • This plugin hasn't been tested on multisite so I don't know how it would behave.

  11. I just installed this plugin and love it! Thanks!

  12. Hello, I just installed Real Time Find and Replace (WP v 3.2) and when I click ADD link, nothing happens -- no new window, nothing. Is there something I have to set (apart from activation) before it will function? Thx.

    • Hi Peter, Not sure why this happened, but the associated JavaScript files didn't get into the distribution file that is in the plugin repository. I'm working on correcting it now.

    • Hi Peter, Plugin distribution is now fixed. Just grab the latest version (1.3.1).

  13. Is there any way to filter the trigger so it only works on the index.php? That way the replacements wont affect the posts?

    • Marios Alexandrou

      Andrew, There is no filtering available. I've thought about that before actually, but for me it is a "neat" idea and not one that I had enough need for to justify the effort. Sorry!

  14. Marios - useful plugin, but i am struggling with Regex turned on. Catastrophic result as the page does not load. I'm thinking it might be because I am running WP 3.0. Are you aware of any issues with it running on 3.0? Thank you.

    • Does the page load as a blank page? I have this same issue quite often. Check your regex and see if you are not striping any DIV tag in the process. Look at your pageĀ“s source without applying the regex and then make some experiments. There are plenty of regex testers online that can help.

      • yes, all blank. any, even the simplest, regex logic i use produces that same result.

        • Do you use an $ before and after your regex? Here is an example of a regex I use: $class="more-link"(.+?)(?=)$s

        • The comment system strips out some part of my code. The underscores do not really exist: $class="more-link">(.+?)(?=)$s Replace with a closing div tag.

    • Marios Alexandrou

      Hi Kevin. There may be some issue with WP 3.0. I have yet to migrate so I haven't tested out the plugin yet.

  15. I just installed this on a 2.9.2 website, and it doesn't seem to be working. I click on the "Add" button on the Real Time Search and Replace Tools page, but nothing happens. Shouldn't I get some kind of form to allow me to define rules? Dan

    • Marios Alexandrou

      I'm using this plugin on multiple 2.9.2 installs. Clicking the Add button creates a new row of input boxes.

    • Dan, maybe you can see

  16. Hi, I really like your plugin and I've installed your plugin in my several blogs and it works correctly. But while I tried to install in my latest blog, it won't work. I can't add any input text in the setting page. --- Click "Add" below to begin. [Add] ----- when I clicked [Add] button, it won't display anything (the input form). .. Probably you know the solution,.. thanks..

    • Marios Alexandrou

      It looks like I missed including some files with the 1.1 release. I've corrected that omission with 1.2.

  17. Hi! I think there is a little bug in the plugin. Whenever I set a rule to search something that contains "#038;", it strips this string out from the "find" field as soon as I click the apply settings button. It happens when using both options, regex or not. Is this expected behavior or it is a real bug? What can I do to surpass this behavior and make it actually search for "#038;"? I've tried to escape all characters, but no joy either. Thanks a lot!

    • Daniel, I was able to save a rule with "#038;" in it. I didn't do anything special and it saved the first time. Are you able to enter other rules without problems?

      • Discovered that the problem is an "&" before the #308, making the problem string "&#308". The first time the rule is entered it stays there. If I go to another page and then go back to the plugin's settings, the "&#308" is not there anymore. Anyway, the string is part of a URL, if that matters. All other rules are always OK, only the ones using something like #+number are giving me this problem :( Thanks!

  18. Hi. I've noticed that the plugin filters my feed, too. Is there any easy way to exclude the feed from being filtered? Thanks a lot!

    • Marios Alexandrou

      Sorry, there is no easy way i.e. no options you can set.

      • Ok, I didn't mean THIS easy ;) An "IF is_feed" well placed should do the trick, maybe? I am starting to study wordpress, if you could point me to the right direction, maybe I could figure it out. Thanks a lot!

  19. Marios Alexandrou

    Do you mean that if there's a match, but it's in the meta keywords, the replacement shouldn't happen? You can achieve this by using regular expressions although such regular expressions could get rather complicated.

  20. Hi. When using the plugin without marking "Regex", it works just fine. If I mark the "regex" box, I get a blank page on my blog (even with very simple regex expressions, like find my name and replace with another name, and even if I left all fields blank). So, marking the option "regex" just gives me a blank page (no code at all). Is there some special way to use it with regex? I am using wordpress 2.8.3. Thanks a lot!

    • It seems that it is needed to enclosure the regex between . Is it a problem with my installation or this is the way it meant to be? Is it included in some plugin documentation? I couldn't find it anywhere. If I use a regex very simple like or , it works fine. I am trying to rip off all images from posts syndicated with the FeedWordpress plugin, using the following regex: ]*>(.*?) As I have to enclosure it between , it becomes: <]*>(.*?)> But it does not work. All I get is the blank site again. What am I doing wrong? I am sure the regex is right, because I took it from the regex website, so I think I am missing something, maybe escape some of the >s, but it does not work with > either. Help, please?

      • My examples get truncated... Anyway, if I use a regex like [Dd]aniel it works fine. If I try to use > greater and < lesser, it goes bad.

        • Marios Alexandrou

          Sorry that you're having problems with the plugin. I don't have any really complex regular expressions in use at the moment, but I do have one that might help. This one replaces the WordPress generator meta tag. Note that the regex starts and ends with a forward slash. And the forward slash that's part of the HTML has to be escaped with a backslash. /<meta name="generator" content="WordPress [0-9].[0-9].[0-9]" />/

        • Exactly what I was needing. Also, the site has valuable infos regarding the use of regex with PHP. Thanks a lot!

        • Any chance to get this filter to work on the post itself, filtering content in the database itself, instead of just on the reader screen? I think it would be great :)

        • Marios Alexandrou

          There are other plugins that make permanent changes to post and page content.

  21. i downloaded it and it really works and i have found it as the best replacement tool for word press.....

  22. This plugin breaks my wordpress 2.8.3 install any ideas?

    • Marios Alexandrou

      Works fine for me on 10+ installs of 2.8.3.

  23. I would like to replace some HTML code in my posts but it seems it dosen't work. I use WP-Super Cache, is it compatible ? Thanks! ;)

    • Marios Alexandrou

      Super Cache creates an HTML copy of the page that is delivered to the user. Once the HTML copy is created, plugins aren't executed so you won't be able to do a find and replace with my plugin. However, assuming Super Cache executes all plugins before it caches the page, then the find and replace functionality should work just fine. Note that I haven't tested this yet.

  24. Okay, I see the need and I need it. {Problem is it doesn't work on ANY of my sites!! Help please. Hitting add simply does nothing but add a # to the end of the url. Help would be appreciated. Tested on Linux and Mac, Firefox on both and Safari on Mac. Garret

    • Marios Alexandrou

      Any chance that you didn't unzip the sub-folder included in the archive? The JavaScript files that house the add a box functionality are within the JS folder.

      • LOL, that's it, look at your zip file, it's missing the js folder

        • Marios Alexandrou

          Oops. I'm not sure how that happened. actually creates the zip file so I guess I somehow failed to submit the js sub-folder. I just uploaded a new version 1.0.2 and it looks like all files are included this time around. Sorry about that!

        • Any help with my below comment?

        • Marios Alexandrou

          I'm trying a similar replace and it's working fine for me. I've actually set up a rule to change the "Any help with" part of your comment to a link. Did you type in the find / replace rules or paste them from somewhere? Maybe a funky character (tab or something) got in there.

        • Right, works find with a url that fits within the form field, try a very long url, something longer that the form field.

        • Marios Alexandrou

          I dropped in a long URL. Still works fine for me. Check out the "any help with" text to see the URL I used.

  25. Works great, thank you

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>