How To Search and Replace Text In WordPress

WordPress search and replace plugin allow you to quickly replace some text, Domain and string from your entire WordPress website with single click. All you have to do is, Provide the string that you want to replace and the string that you want to be replaced with.

Have you just migrated your WordPress to another domain? or do you need to search and replace some name or url’s from your WordPress? In this tutorial, I’ll show you how to perform mass search and replace in WordPress. In this tutorial, we are going to use WordPress plugin.

Though phpMyAdmin and MySQL query are capable of perform mass search and replace, But using plugins are recommended. Because as a beginners, you must not so comfortable with code and plugins let users perform search and replace in WordPress database from WordPress administration page and this method also provide a user friendly interface that make this task lot easier.

When Do you Need To Search and Replace in WordPress Database?

If you have added a specific text or url’s to a number of posts or you have just migrated your WordPress from one domain to another and there is still a lot of interlinked hyperlink point to the old domain that you want to replace with new one.

But there are a lot of post you have to edit to replace them or you don’t know exactly which posts you have added that text or which post has linked with old domain.

You can fix them manually by editing each post of your site, That is time consuming and a lot of work.

Alternatively you can use WordPress plugin to perform mass search and replace texts and links in WordPress database.

You can also perform Search and replace with MySQL query in phpMyAdmin. But as a beginners you must’t ready to play with code, Huh/..

There is one downside of using WordPress plugin for searching and replace is, If you made mistakes here, You can’t undo it unless you have your WordPress database backup ready.

Search and Replace Text In WordPress Database

We’ve found two WordPress plugin for this and both plugins are well rated with Millions of Downloads. I’ve tried both of them and from my experience of using that two WordPress plugin, I believe that both plugins are beginners friendly and perform their task automatically.

Note: As I wrote earlier that changes in MySQL database isn’t reversible unless you have proper backup of your WordPress database. It also a good practice of creating WordPress backup before making any major changes.

As the searches and replaces in WordPress database made by WordPress search and replace plugin isn’t reversible. That means is anything goes wrong, You can’t undo the change. So create a backup before performing bulk search and replace in WordPress database.

You can easily create WordPress backup using WordPress backup plugin. Once you have your WordPress backup ready, Now start replacing text in WordPress database using plugin.

Search & Replace

Search & replace is a WordPress plugin that can perform Search and replace in WordPress database. This plugin comes with built-in Database backup and restore tool. That’s mean you can backup your WordPress database using this plugin before running search and replace and you can also restore the backup and anything goes wrong.

It also has a feature called “Replace a Domain/URL” that is really useful for a quick and simple site transfer or migration.

In order to perform find and replace using search & replace WordPress plugin, All you have to do is:

First install and activate search & replace plugin to your WordPress.

Now visit Tools > Search & Replace to use this plugin

In the welcome page you can create WordPress database backup by clicking on the Create SQL Filebutton.

Click on the Search & Replace tab and now type the string that you want to search into _Search for _field.

Type the replace text into _Replace with _field.

After that select the tables that from the list you want to look into. (If you just want to search and replace text from Post body then choose __posts _table.)

Now finally click on the _Do Search & Replace _button to start searching and replacing.

This plugin can perform dry run that will show you how many and which cell will be affected without actually perform replace. It also has extra advantages in site migration to another domain. You can access the feature by clicking to Replace Domain URL _tab from _Tools>Search & Replace.

Better Search Replace

Better Search Replace is another WordPress plugin that can perform search and replace in WordPress database from WordPress administration area. This plugin is very lightweight and easy to use. This plugin doesn’t have support for WordPress backup but you can utilize another WordPress backup plugin for that.

In order to perform a search and replace using Better search Replace, Follow the instructions below:

Install Better Search Replace plugin to your WordPress.

Once activated, Visit Tools>Better Search Replace.

Type the string that you want to search for in your WordPress database into Search for field and then type the replace text into Replace with field.

Select the database tables that you want your search and replace perform in…

Click on the Run Search/Replace button to start the operation.

This plugin can run a case sensitive search and replace command to your database. You can enable or disable Case sensitive search by checking/un-checking _Case Sensitive? _field. You can also perform dry run that only show how many cells will be affected without replacing.

That’s it! Now you know the best way to perform mass search and replace in WordPress database without MySQL query and phpMyAdmin. If you know other ways, Please let us know using the comments box below.