Useful Information from Prolific Bloggers

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

VN:F [1.9.16_1159]
What did you think of this article?
Rating: 0.0/5 (0 votes cast)

49 Comments

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

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

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

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

        • Write me at gmail and maybe I can help. The comment system is not working with me :(

        • get my email from my first answer, ok?

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

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

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

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

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

  9. I would like to make a donation. Can you modify the plugin not to rewrite the KEYWORDS meta?

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

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

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

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

    • Marios Alexandrou

      Works fine for me on 10+ installs of 2.8.3.

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

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

        • Heh, np. Quick question. Trying to replace text with hml but the html wraps once updated and it wacks everything out. I would imagine that I have to escape something to stop this. Any help there?

          As an example replacing the word, video, with videos

          Thanks
          Garret

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

  15. Works great, thank you

Leave a Response

Notify me of followup comments via e-mail.