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.

Translations

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!

Donations

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.




Limitations

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

Usage

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

Examples

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.

TEXT TO REPLACE

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

Installation

  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.

FAQ

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.

Screenshot

Click for a larger view.

Click for a larger view.

Changelog

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]


{ 51 comments… add one }

  • Fuku November 7, 2011, 7:01 am

    down with u by this plugin! this plugin can not replace image urls! down with u

Leave a Comment

Next Post:

Previous Post:

Twitter Feed