WordPress Plugin: Find and Replacer

Please be aware that this plugin was built quite some time ago and I haven’t had a chance to update it in some time. It may work properly, it might not. Make sure you have a database backup before using.

Blogs often live online for many years. The problem is that the blog often changes its look or code base, and must update all the earlier posts.

That’s where my newest plugin comes in; Find and Replacer enables you to find and replace single words or phrases, and even entire tags. This means that within seconds you can replace all the early tags in your blog database with the newer ones.

Sure there are other WordPress search and replace plugins out there, but none offer the level of power that Find and Replacer does.

It has been tested up to the latest version of WordPress, 2.7. Due to the nature and unique properties of many blogs, please let me know if your find request does not work properly. If you have problems with an earlier version, or even if it works properly, please contact me or post a comment.


The next version of Find and Replacer is compatible with WordPress’ locale system. If you are interested in translating for your locale, please comment below or use the contact form and I will send you the required .PO file for you to translate.

Current translations

Thank you to all those who have offered to translate!


If you wish to donate to further the development of this plugin, please use the PayPal button below. Comments on posts are also very valuable to me.


  • Processor-intensive when checking a large quantity of pages.
  • Search is case-sensitive.
  • Whitespace must be similar.
  • International characters must match those stored in the database.

Latest changes

Version 1.5 brings a number of advanced changes to the plugin. In addition to improved search behavior, users can now search through comments and make replacements there. Revision interaction has also changed. Database records are no longer overwritten regardless of post status — you can skip revisions and only make changes to displayed posts.

It is highly recommended that you keep revisions enabled and use the default revision behavior. This way, should the plugin make a change you don’t like, you can return to an earlier state.


  • After activating the plugin, navigate to the admin panel interface, where the options can be entered to edit the required number of pages or posts.
  • View the page list at the bottom, and enter the correct attributes for replacing your text.


To replace Hello world with Goodbye world enter the following.

Starting ID of page: page ID
Ending ID of page: page ID
Text to find: Hello
Text to replace: Goodbye

To replace tags with tags and leave the inside text alone, enter the following.

Starting ID of page: page ID
Ending ID of page: page ID
Text to find: (*)
Text to replace: (*)

The plugin now has the ability to replace tags when they surround other tags. For example, to change Text to Text, do a normal tag query.

Starting ID of page: page ID
Ending ID of page: page ID
Text to find: (*)
Text to replace: (*)

To modify only a single page, enter that page’s ID in both the first and last ID field.

Starting ID of page: 100
Ending ID of page: 100

After receiving a comment about replacing text with whitespace, I’ve added an example. Currently to replace text with whitespace you must make your find text include whitespace.


To replace this, you must use the following query.


This kind of replacement won’t work.


I’m working on a solution and hope to include it in a later version.

Caution: This plugin is extremely powerful. A slip of the mouse can cause your blog to edit many phrases that you wished were left alone. Be sure to read the options carefully.

Download latest version of Find and Replacer


  1. Copy the folder find-and-replacer into your WordPress plugins directory (wp-content/plugins).
  2. Open the WordPress Admin Panel and activate the plugin.
  3. Navigate to the Admin Panel for Find and Replacer, where you can edit all the pages you desire.


What is the purpose of this plugin?
With blogs growing larger and larger all the time, Find and Replacer makes it super easy to edit pages throughout your blog installation. Change everything from words and phrases to complete tags.

What options are available?
In the interface panel, you have the ability to fine tune the editing process. You can:

  • enter the starting and ending page IDs of posts you want to modify
  • select the entire post database
  • choose between editing the post content, title, or both
  • view page IDs and other data for your posts

How does it all work?
Find and Replacer uses the REGEX engine, or regular expressions. This is a powerful system built into PHP for finding and replacing text when only specific data is known. This is the only way to replace entire tags in one pass.

Can I change tags surrounding tags?
Fixed in version 1.1, FAR can now modify tags when tags are inside. It does this by breaking the request into two queries. For more examples please visit the examples section.

Can I replace text over multiple lines?
Yes. If you are replacing text with multiple lines and you want to preserve text inside it, you just need to put the placeholder (*) in the correct spot. A fix is upcoming, but until then have a look at the examples.

How does FAR work with revisions?
As of v1.5, Find and Replacer changes the way it interacts with revisions. Previously it edited each entry in the database as if it were the same. Now, you have the option to skip revisions. This means that if your search does not go the way you want, you can return to a previous revision with no issue.

Can I modify comments?
In v1.5, yes.


Click for a larger view.

Click for a larger view.


v1.0 –– August 5, 2008
* Initial release

v1.1 — August 9, 2008
* added ability to change tags surrounding tags

v1.2 — August 20, 2008
* made replacements compatible with PHP 4
* updated readme about whitespace

v1.3 — September 9, 2008
* brought up to WordPress translation standards
* includes French translation

v1.3.1 — September 11, 2008
* displays other languages properly

v.1.4 — September 12, 2008
* updated replacement algorithm
* displays the post type

v1.4.1 — September 24, 2008
* prevents blank posts or pages from being written to the database

v1.5 — October 6, 2008
* lowered number of database queries required
* improved search algorithm
* added ability to search comments
* added ability to skip revisions
* made search more accurate when replacing entire post
* improved accuracy of replacements not requiring REGEX

v1.6 — January 6, 2009
* Added WordPress 2.7 compatibility

View all plugins

[tags]Wordpress, blog, plugin, automate[/tags]

Posted in Wordpress Tagged with: , , , ,
51 comments on “WordPress Plugin: Find and Replacer
  1. thanks for this simple software. it’s made my job much more easier. cheers

  2. I don’t yet have a use for this but I think I will as I change around some of my tags. Thanks!

  3. wesg says:

    @Paul Stamatiou
    Thanks, Paul. Have a look at my other plugins!


  4. SW says:

    I LOVE this plugin and have used it on some small find/replace tasks. I am not a great database person, so using sql code is difficult for me, so this plugin EASILY fixes my problems :)

    However I have one problem I’m trying to fix: some of the data I want to find/replace is on multiple lines and there is a varying degree of white space between some of the code in different tables.

    A great modification to make this even more powerful would be to search for multiple lines of text and then to also ignore white space.

  5. wesg says:

    Thanks a lot, I really appreciate it! I will certainly look into that for the next version.

    Do you have any example text?

  6. Thuy Lam says:

    Thanks for sharing.

  7. SW says:

    @wesg: sorry for my delay :)

    Ok, for example in my posts I copy/paste form Dreamweaver HTML code. I have other plugins on my blog that allow me to perfectly render that HTML within the posts, but sometimes I need to go back through a few dozen posts to change the code.

    For example here is some code I want to find:


    <table width=”155″ border=”2″ cellpadding=”5″ cellspacing=”2″

    So you see? Because there are multiple lines, plus white space between the content, it’s not possible to do big chunks like this at one time.

    Hope that helps! :)

  8. wesg says:

    @SW: I had a look at your text and was able to make changes. I assume you have text between the two tags you have provided and wish to leave that alone. There is a small issue with whitespace, and I’ve added a new example to the page.

    When I tested your code and searched for it, I could find the tags you provided. Is that what you were looking for?

  9. baron says:

    hi. Thanks for plugin



  10. Boris says:

    Thank you very much Wes. Thank you for the link

  11. paulpop says:

    I tried to use your plugin to make a text change to my posts. Every post and title with that character combination was erased, all text not just the one i wanted to change.

    I’m running wp 2.3.3
    Is there some limitation to what kinds of characters can be changed?
    I tried to use this as a simple charset mismatch fix

  12. wesg says:

    @paulpop: Find and Replacer v1.4 escapes characters that could break the database code, as some text can conflict with the algorithm that does the finding.

    If you could, please use the contact form to send me some example text and I will work on a fix.

  13. How would you find double spaces between words–that is, not after periods? If the plugin could do that, I’d definitely want to use it. I’m always mortified when I read an older post and then discover I have double spaces all over the place–like this, for example.



  14. LOL. Your theme purified my example, but you get the idea.

  15. wesg says:

    @Haid Dasalami: What exactly do you mean with my theme? :) I’ll look into a way to replace double spaces that don’t happen after periods and try to add it to the next version.

  16. That would be great and much appreciated. By the way, the converse would also be desirable, for those of us who format the old-fashioned typewriter way: that is, it would be nice to be able to find all the SINGLE spaces after periods as well. I suspect there are more than a few blog authors who’d kill for such a tool. (Considering my niche, maybe I should rephrase that). 😉

    One other thing. Is it necessary to set up the “find” with the “replace” string? Is it possible just to find the text string and then decide whether or not to replace it?

    I suppose I ask too much, but I AM thinking of a couple nice uses for this plugin. One thing is that Islamic transliterations are often spelled in various ways. I try to be consistent with my preferred spellings, but I don’t always succeed, and I really don’t want to change another writer’s spelling choice when I quote them, for one thing. That’s just one example.

    Anyway, I’ll be watching for developments, and when I get a chance I’ll be testing the plugin as it stands now.

    Best regards,


  17. Aaron Law says:

    Oh my god! That’s what I want since I’ve been a blogger in 2002!

  18. How about a wild card search/replace feature?

    What I mean for example

    Take: title 999 replace

    Search: title ???? replace
    Replace: title replace

    In order words: the numbers or text indicated by a question mark may be different from string to string, but that would allow me to eliminate all of them.

    Make sense?

    Or do you already have this capability somehow?

    Gene Steinberg

  19. wesg says:

    @Gene Steinberg: this functionality is built into the plugin already. By using (*) in place of the ???? you can make replacements without knowing the value of the actual text. Currently the limitation that I just noticed is that if you happen to have more than 1 title ??? replace in the post, it will replace the entire post. I’ll have to work on that.

  20. Oh, great. That may be just the ticket. :)


  21. Tried. Isn’t working.

    I’m trying to replace, for example:

    [quote comment=”12814″] and turn it into [quote]

    So I’d use one (*) for each wildcard character or for all characters?

    I’m searching in Comments.

    Isn’t working.

    What am I missing?


  22. wesg says:

    @Gene Steinberg: One wildcard is required, so in your case I was able to turn [quote comment=”12814″] into [quote] by using the find string of [quote comment=”(*)”].

    You say you’re searching in comments, but currently FAR doesn’t search through them. It is limited to titles and post content.

  23. Oh. :(

    Any other alternatives?


  24. wesg says:

    @Gene Steinberg: stay updated with the plugin, and I will try to add this feature in the coming days.

  25. Thanks. I’ll try to check back here every so often. :)


  26. Your new version was partly successful. I was able to remove the wild cards in comments, but when I tried a straight search/replace of regular text to correct to blockquotes, it replaced everything in the blog instead and I had to restore from my backup. Not a great loss, because I was able to restore to something posted only a couple of hours earlier. But I am concerned about this.

    On the positive side of the ledger, it allowed me to switch from Quoter, no longer being developed, to WP Threaded Comments.


  27. Bryan says:

    Is something special required when dealing with slashes [/]?

    I’m attempting to replace the location of graphics files after a ISP change.

    Example: /home.earthlink.net/~bldumka/

    replaced with: /www.dumka.us/

    The code responds with a warning about mismatched number of parameters and nothing is changed.

  28. wesg says:

    I had a look at the plugin and tested it with your text, and it replaced properly. I searched for /home.earthlink.net/~bldumka/ and replaced it with /www.dumka.us/ without issues. I even tried it inside an image tag in a post with lots of text, and it worked as expected.

    Could you copy and paste the exact code that was printed to the screen?

  29. Bryan says:

    The following lines were repeated dozens of times:

    Warning: Wrong parameter count for str_replace() in /f1/content/whynow/public/wp-content/plugins/find-and-replacer/find-and-replacer.php on line 165

    Warning: Wrong parameter count for str_replace() in /f1/content/whynow/public/wp-content/plugins/find-and-replacer/find-and-replacer.php on line 198

    Warning: Wrong parameter count for preg_replace() in /f1/content/whynow/public/wp-content/plugins/find-and-replacer/find-and-replacer.php on line 199

    and the final message was:

    No changes were made because some posts were empty.

  30. Bryan says:

    As it might make a difference:

    WordPress 2.6.3
    PHP 5.2
    MySQL 5.0
    Character encoding UTF-8

  31. Robin says:

    Works beautifully, but doesn’t make changes to the excerpts — is that a possible future upgrade?

  32. Fabio says:

    Don’t works on WordPress 2.7.1?
    Warning: Wrong parameter count for str_replace() in /home/central3/public_html/tubepornobr.com/wp-content/plugins/find-and-replacer/find-and-replacer.php on line 168

    Warning: Wrong parameter count for str_replace() in /home/central3/public_html/tubepornobr.com/wp-content/plugins/find-and-replacer/find-and-replacer.php on line 203

    Warning: Wrong parameter count for preg_replace() in /home/central3/public_html/tubepornobr.com/wp-content/plugins/find-and-replacer/find-and-replacer.php on line 204

  33. plienine says:

    I am searching how to mass remove links?
    For example:
    I have links which I do not know, and want to reaplace all them.
    I tryied to find a href, but it only remove a href, but left link as text.

    What suggestions?

  34. criticalbiz says:

    Super-useful plugin. Nice work.

  35. Hi. I just installed this plug-in, activated it, navigated to the Edit Posts page but don’t see any option for entering search terms. The Edit Posts pages looks exactly as it always has. Did I miss something? BTW I’m using WP Version 2.9.2

  36. Ricardo says:

    Is it possible to make it automatic? Means.. everytime x keyword is posted it goes replaced by one else??

  37. Akin says:

    You are a GOD! (send) :)

  38. Gary says:

    Has anyone tested this plugin with version 3.0.1?

  39. Dean says:

    Yeah this is one of the most powerful plugins I can think of and yes it’s great.

    I just wanted to know though if it was possible to streamline it a bit more instead of replacing word by word.

    For example:

    words to find:

    replace with:

    It would be even better if it allowed multiple word change queries in one go for example (where X is the the words to find and Y is the words to replace with:

    1X Find words:


    2X find words:
    chasing after

    2Y replace with:
    walking towards

    where the numbers 1, 2, 3, 4, … etc hasn’t got a limit. That way we can replace multiple words or phrases all in one click of a button (we’d be able to store and save this list by copying and pasting etc and just building on it.

    I hope you understand what I mean, even if it can’t be done, this tool is probably the most frequent tool I use.

    Thanks heaps.

  40. wesg says:

    @Dean: Thanks so much for the comment and excellent feature request. I hope to fit in some plugin upgrades in the near future, and I’ll definitely take your idea into consideration when I make the improvements.

  41. Brad says:

    Well, I’ve used this before with success… however, today I used it to remove a tag from a previous theme which appeared on nearly every page… it was [separator] … well, it made every word on every page completely screwed up. So bad that i had to just recover/restore from last night’s back up which cost me an entire day’s work.

  42. sui says:

    yeah, it works fine sometimes but it creates serious problems other times… like with a large number of posts, random letters were replaced with nothing! :< please help.

  43. Ricky Price says:

    Your plugin is exactly what I had been looking for. You can’t imagine the amount of work hours you have saved me. I would like to help you with the Spanish translation if you like.

  44. jflycn says:

    OMG. The program removed all the “\” from my posts. All the latex equations were screwed. There are hundreds of them. If the author read this, please please email me how to save my posts. :(

  45. wesg says:

    @jflycn: I’m sorry the plugin did that to your posts. I built the plugin some time ago, and couldn’t test against all the possible scenarios. I hope to have a new version out some time that can better handle complex replacements, and perhaps add revisions instead of overwriting everything. Hopefully you have a database backup that you can restore to. If not, I’ve been able to rebuild my database using the Google cache.

  46. Sven says:


    This is a very usefull plugin, I hope that you some day find time to upgrade it to WP 3.1 (3.2 comming up soon).

    Thank you for sharing your knowledge!

  47. Mike Carter says:

    Hi — yes, this plugin is IT! And I want to throw in my two cents with Dean, above (below?). Multiple replacements is definitely needed. I use this to get rid of those code-destroying curly quotes. To be able to do both the left and right at once and replace with ‘ would be very handy. And, again, like the add quick tag plug in, export and import settings.

    Good job!!!

  48. Smartnickhere says:

    can i set an auto find and replace function?

    please let me know if there are any option available like this…


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=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Twitter: wesgood