This article explains the benefits of performing a search & replace from the WordPress Dashboard. Then, we go over the most popular plugins for performing a database search & replace.
Ways to Do a Search & Replace
Just as the term search & replace would suggest, this is the act of looking for a specific term in the database and changing it to another value. This can be especially useful after changing your site URL, or changing from “http” to “https”. We will now go over some of the popular ways to perform a search and replace.
Search and Replace Directly in the Database
This is when you go directly to PHPMyAdmin or a similar database management software and use an SQL Query. This will often be accomplished using the SQL REPLACE function. This will require you to be familiar with creating the SQL syntax specific to your database. Here is a helpful link to a guide on using the REPLACE function:
Search & Replace using WP-CLI
If you are familiar with WordPress Command-Line, also known as WP-CLI, there is a search-replace command available. This is a fast and powerful way to perform a search & replace since you can bypass the graphical user interface (GUI) and search right from a terminal using SSH.
Did you know? Not all hosting companies provide free access to SSH. InMotion does and it’s just one of the many features of our WordPress Hosting plans.
Search and Replace using a Plugin
When you first install WordPress, it does not have the ability to perform a search and replace included. This means you will have to find another option, such as a 3rd party plugin or a custom-coded solution. Since coding a plugin to accomplish this is more work than most people will want to do, we recommend using a 3rd party plugin
Why Do a Search & Replace from the Dashboard?
One of the main benefits of using a 3rd party plugin is the ability to perform a Search & Replace directly from the WordPress Dashboard. The following are benefits of doing a Search & Replace from your Dashboard:
- You don’t need to know SQL Syntax
- Less chance of breaking the site with a malformed SQL Query
- You don’t need direct database access
- You do not need cPanel Access
- Can be performed using a GUI
Search & Replace Plugins
While there are quite a few WordPress plugins available that are capable of performing a search & replace, 2 really stand out. We will now go over them to familiarize you with them.
Better Search Replace
By far the most popular plugin is Better Search Replace with over 700,000 active installations. This adds a helpful link to the Tools section of your WordPress Dashboard. Enter the term you want to search for and the replacement text then choose a specific table if necessary. You can even perform a case-sensitive search if there are capitalized letters in the search term.
A helpful tool is the ability to do a dry-run where it goes through the process, but does not make any changes to the database. Better Search Replace also includes an adjustment for adjusting the max page size. This is helpful if you are having problems such as timeouts or white-screens. There’s also a Help tab if you want to see information about your server, PHP settings, or WordPress installations. Here is a link to the official plugin page:
Search & Replace
The next most popular plugin is Search & Replace with over 200,000 active installations. One of the things I immediately noticed about this plugin is its ability to Backup and Restore your database. Definitely, some helpful tools when modifying the database.While this has a very similar Search & Replace tool as the Better Search Replace plugin, it also has a specific page for replacing a domain URL. This is an awesome feature if you are changing from “http” to “https” or just changing your site address. Here is a link to the official plugin page:
Now, you know that you can do a search & replace in your Dashboard. Check back soon, as we will be showing you how to perform the search & replace in WordPress in future guides.