There are many reasons why you need to do a search and replace in WordPress. It could be that the article you have written on your mobile device has plenty of typographical errors (due to your keyboard’s autocorrect function) and you want to fix them all with a search and replace. Alternatively, it could be that you updated your database or switched to a new web host, and some weird characters are showing up in your posts. Regardless of the situation, it is always handy to have a search and replace function in WordPress. Most text deditors come with this function, so why not WordPress?

Search and Replace button in WordPress Post editor

If all you need is to add a Find/Replace button in post editor so you can easily fix up the typographical errors in the article, TinyMCE Advanced is the best plugin that you can use.

After it’s installed, you can go to “Settings -> TinytMCE Advanced” to find a list of buttons that you can add to the post editor. One of them is the “Find/Replace” button. Drag that icon to the editor menu and click “Save Changes.”

wp-tinymce-advanced-find-replace-button

Next, go to your Post editor, and you should be able to find the “Find/Replace” icon in the toolbar. This is what you will see when you click on it:

wp-tinymce-advanced-find-replace-dialog-box

Similar plugins that you can use include WP Edit and WP Super Edit.

Search and Replace text in all posts/pages/custom post type

If the mistake that you are rectifying occurs in all posts or pages, then the Find replace plugin is the one for you. What it does is search through all your posts/pages/custom post types for the search string and replaces it with the corrected string. This is particularly useful when you migrate to a new domain and want to change all the links from the old domain to the new URL.

wp-find-replace-plugin

Once installed, you can find the tool in the “Plugins -> Find and replace” section. One good thing about this plugin is that other than post content, it can also change postmeta value.

Search and Replace value in the database

Instead of text in the post content, if what you are changing is a site-wide value, including plugin settings, system settings, etc., you will have to edit the database directly. Luckily there is a tool for this. The Search and Replace plugin allows you to find strings in your WordPress database and replace them with another string. You can search in ID, post-content, GUID, title, excerpt, meta-data, comments, comment-author, comment-e-mail, comment-url, tags/categories and categories-description. It is also possible to replace the user-ID in all tables and the user-login. As you can see, this is a powerful tool, and any mistake that you make might break your WordPress database. Only use this if you know what you are doing, and do backup your database before you proceed.

wp-search-replace-all-search

After the installation, go to “Tools -> Search & Replace.” There are two options: you can choose to do an “All search (and replace)” or select the database table to search and replace. The search is case sensitive and has no pattern matching capabilities. You can perform a search first without replacing and verify that the data you are replacing is correct. After that, you can then proceed to do a search and replace.

wp-search-replace-custom-search

One thing to note is that this Search & Replace plugin doesn’t search serialized data. Technically it means that if a plugin saved its data in array format, its value cannot be modified by “Search and Replace.” Only the text value will be searched and replaced.

Conclusion

Depending on the degree of search and replace function that you want to carry out, there is a plugin available for you. The last method that you can use is to amend the database value directly via phpmyadmin, but that is too technical and is not recommended for everyone. Let us know if you have come across another useful search and replace plugin not mentioned above.

Image credit: tango edit find replace

How To Save Highlighted Text in Firefox Into a File

Researching on the Internet can sometimes be cumbersome. The Save Text To File extension for Firefox allows you to save highlighted text in any web page into a .txt file, then save it in any location on your hard drive.

Analyze Writing Errors with SlickWrite for Firefox and Chrome

Most spelling and grammar checkers in word processors spot obvious writing errors, but not the less obvious ones. Slick Write is a web service that analyzes writing errors as well as performs the usual spelling and grammar check.

Show Notification Counts on Pinned Tabs in Chrome

Do you use pinned tabs in Chrome as a way to keep up with your email and/or social networking sites – like Facebook, Twitter, and LinkedIn? Wouldn’t it be great if you could display notification counts for messages and unread items on your pinned tabs? Here’s how you can do so.

How To Sign Documents From Gmail

What do you do when you receive a document that need to be signed? You will have to print it out, sign it and rescan it before you can send it back. HelloSign allows you to sign a document sent to your Gmail address and sign it from there.

Can Tor Really Protect Your Online Privacy From The NSA (And Other Government Organizations)?

When the news that the NSA are keeping records of your phone calls and web data transfers broke out, people start to worry if they are really safe online and some of them switched to Tor to protect their privacy online. The question is, is Tor really safe? Does it really protect you from the NSA’s clutches?

4 Ways to Embed and Email Web Pages to Your Friends

If you want to email web pages to friends, you can either send them the URL or use any of these 4 ways to embed the web page directly in the email.

How To Play Flappy Bird on Any Phone, Tablet or Computer

Flappy Bird is no longer around in the App store, but if you just want your old game back, there’s also a HTML5-based clone edition of Flappy Bird.

Is the Era of Privacy Over?

The governments have been using various measures to get hold of our information. So, have we left the era of privacy behind us?

Stop Facebook from Selling Out Your Browsing Data

Facebook stated that it is going to share the data it has collected with advertisers so they can show you more relevant ads. Here is how you can prevent it.

How Anonymous Are You on the Internet, Really?

If you really want to be anonymous on the web, here are a few things you got to know and also learn a couple of tenets.

Three Ways To Educate Yourself Right Now About Internet Censorship

The Internet isn’t free, as much as you like it to be. This article examines 3 of the best online resources where you can learn about Internet censorship.

How to Copy Links as Plain Text in Firefox

Do you just want to copy the text of a link, and not the link? Link Stun can disable links in highlighted text so you can copy them as plain text.