Real-Time Find and Replace for WordPress

Magnifying Glass

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

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 real-world examples:

1. Don't like the "Category:" text that the Dagon Design Sitemap plugin puts in front of every category? Remove it!
2. Annoyed by the link that Global Translator adds to every page? Remove it!
3. Have you noticed that the Sociable plugin doesn't correctly display the Twitter image? No problem, insert it!

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!

Version History
1.0.0 Initial Release
1.0.1 Adjusted input box sizes so page better fits at lower resolutions
1.0.2 Corrected issue with missing files in distribution

Did you like this article?
1 Star2 Stars3 Stars4 Stars5 Stars
(3 votes, average: 4.67 out of 5)
Loading ... Loading ...

61 Comments

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

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

  8. 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).

  9. 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!

  10. 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.

  11. 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 http://wordpress.org/support/topic/plugin-real-time-find-and-replace-missing-js-folder-on-v-11

  12. 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.

  13. 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!

  14. 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!

  15. 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.

  16. 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 http://www.regular-expressions.info/php.html 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.

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

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

    • Marios Alexandrou

      Works fine for me on 10+ installs of 2.8.3.

  19. 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.

  20. 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. WordPress.org 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.

  21. 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>

Current day month ye@r *