How to perform Search and Replace in WordPress Database

By on May 2nd, 2021

WordPress allows you to create a variety of websites or web pages. In the future, if the requirement arises to replace a single word with a different word on a whole WordPress website. It is challenging work. So WordPress has one plugin in WordPress repository for this purpose, the Search and Replace plugin. The search and replace plugin is used for changing Specific Texts within a WordPress website. With this plugin, you can quickly search for a particular word and replace it with another word.

For the change in the WordPress website database, The search and replace plugin is widely used. This plugin allows you to create full database backups and restore so that you don’t lose the current state of the website in case something goes wrong. The customizable plugin is ideal for users as well as developers. With this plugin, you can also replace domain and URL quickly and easily, so it becomes easier to migrate a WordPress site from one domain to another. The search and replace plugin have excellent support with multiple sites.

The search and replace plugin also handles serialized data of the WordPress website. With this plugin, you can choose dry run or download SQL files. This plugin has been localized and ready for your language.

In this tutorial, I will show you How to install and use the Search and replace plugin in WordPress. So, let’s get started with the first section to install this plugin.

Install Search and Replace plugin in WordPress

Step 1: Log into your WordPress account Dashboard with your Username and Password.

You will require administrator access to the site as we will install a new plugin in your WordPress installation.

Step 2: Now, click on the plugins tab that is available in the left sidebar as you can see in the below image.

Perform search and replace in WordPress database

Step 3: After you click on the Plugins tab, The plugin page will extend on your screen. Now, click on the Add New button. This button available on top of the page, or click on Add New tab at the left-side tab section.

Add new plugin in WordPress site

Step 4: You will get one Search Box on the top-right side of the screen. This search box will help you to find the desired Plugins easily. Type your file name (Search and Replace) in the search box.

Search for a plugin in WordPress Repository

Step 5: Below the Search box, you will find your Search Lists. You have to find your correct plugin from the Search results that is Search & Replace. Click on the Install Now button available on the plugin card.

Search and Replace plugin for WordPress

Step 6: The Installation process will take some time depending on your server’s network speed. Once the installation process complete, the Install Now button will change into the Activate button.

Activate Search and Replace plugin in WordPress

Step 7 : Now, you have to click on the Activate button to activate the downloaded plugin for further use.

Now WordPress will redirect you to the plugins page. On this page, you will get to see one Notification bar. In this Notification bar, you will get the confirmation that your plugin is now Active. Now we can start using this plugin to replace stuff in our WordPress database.

How to perform Search and Replace in WordPress

Step 1: Log into your WordPress account Dashboard with your Username and Password.

Step 2: Now, click on the Tools tab that is available on the left side of the plugins page as you can see in the below image.

WordPress tools

Step 3: Now, click on the Search and Replace menu from the Tools menu as you can see in the below image.

Search and Replace option in WordPress

Step 4 – Setting Tabs: The highlighted area of the image is the Settings section. In this section, you will see Tabs like:-

  • Backup Database:- Database Backup plugin helps you to create Database Backup and Restore Database Backup easily with a single click.
  • Search & Replace:- Search & Replace plugin lets users easily search and replace data in the database.
  • Replace Domain URL:- This will help you to replace the old domain with a new domain easily by the URL.
  • SQL Import:- SQL Server Import and Export Wizard is a simple way to copy data from a source to a destination.

List of actions we can perform on database

Step 5 – Backup Database Tab: Now, come to the Backup Database Tab. This will help you to create a Database Backup easily with one single click.

Step 6: Then you have to click on the Create SQL File button which is available in the blue color as you can see in the below image.

Export current WordPress data to SQL format

Step 7: Now you can see the Notification box above the Settings Tab in this you will get the button of Download SQL File as you can see in the below image.

Step 8: Now, click on the Download SQL File to download the complete WordPress database SQL file.

Download the exported SQL file

Step 9 – Search And Replace: Search & Replace plugin lets users easily search and replace data in the database. For the further steps, you will get all the information in detail as you can see in the below image.

Search and Replace tab in WordPress

Step 9.1 Search For: This will help you to search the word easily. For example, we search (Demo) as you can see in the below image.

Search for a word in WordPress database

Step 9.2 – Replace With: In this box, you have to write a new word that you want to replace with the old word. In this example, we are going to replace the word “Demo” with (Demo1) as you can see in the below image.

Replace with a specific word in Database

Step 9.3 – CSV Format Search/Replace: With the help of CSV format search and replace, you can replace multiple words with some other words with CSV format. For instance, If you want to replace table with chair, You have to write “table, chair” in one line. Similarly, you can replace as many words as you want by writing them in the new line.

perform search and replace for multiple words in WordPress Database

Step 9.4 – Select Tables: Using this option, you can select the database tables. You can select one or multiple tables at once.

Select the database tables for search and replace

Step 9.5 – Select All: If you want to replace the word/words in the whole database, click on the Select All option.

Note: If you are not confident with a specific search and replace, You can simply select the “Dry run” option to just simulate the query instead of firing the actual search and replace query.

Step 9.6: At last after completing all the steps of the Search & Replace tab. Click on the Do Search & Replace button that is available at the end of the page as you can see in the below image.

Confirm search and replace operation in WordPress

Step 10 – Replace Domain URL: This will help you to replace the old domain with a new domain. You just have to enter the old domain as well as the new domain to replace the domain URL.

Step 10.1 Search For: The Highlighted area of the below image is called The search box. This will help you to find the old URL easily as you can see in the below image.

Search for a URL in WordPress database

Step 10.2 – Replace With: The Highlighted area of the below image is called Replace for. Here you have to write your New URL as you can see in the below image.

Replace old URL with new URL in WordPress

Step 10.3 – Change Database Prefix: If you want to change Prefix in the database, select this option. It is not recommended however, It is because there is a risk in updating something like this in the database.

Step 10.4: Now come to the next option with label New prefix. Here you have to write the new Prefix name. For example(new_) as you can see in the below image.

Change prefix in WordPress database

Step 10.5: At last after completing all the steps of the Replace Domain URL tab. Click on the Do replace Domain URL that is available at the end of the page as you can see in the below image.

Confirm search and replace operation on WordPress Database

Step 11: SQL Import is a simple way to copy data from an SQL file to our database with a single click.

Step 11.1 – Upload Database File: The Highlighted area of the image where you can upload your Database file easily as you can see in the below image.

Import SQL file in WordPress database

Step 11.2: Now click on Choose File to upload your file on a database as you can see in the below image.

Step 11.3: After selecting a file from the computer, click on the Import SQL file button as you can see in the below image.

Import SQL file in WordPress database

It will completely import the whole CSV file into the database. Before performing this action, if your site is running as expected, It is recommended to create a backup.

 

Conclusion: Search and replace for words as well as for domain name is important in many occasions. For instance, If you are migrating your site from one domain name to another, you have to perform search and replace. With the help of this plugin, you can easily perform search and replace for both words and URLs. We hope this tutorial was helpful for you. If you have any questions, You can use the comment section given below. If you are facing any hosting issues, Please let our support staff know, They can instantly help you solve the issue!

Leave a Reply