This article explains how to search and replace content on your site through two different methods. The first method is based on a plugin made to replace content. The second method shows you how to search and replace WordPress content using phpMyAdmin.
Additionally, if the content you want to replace is a domain name, this article shows you a specific way to achieve it using a plugin.
All instructions in this tutorial include screenshots to make it easy for any WordPress-level users to follow them.
How to Search and Replace in WordPress using a plugin:
In this section, I will explain how to use a plugin named Search & Replace, which simplifies replacing content.
To begin, on your WordPress dashboard left menu, move your mouse pointer over Plugins, and then press the Add New button (Plugins>Add New).
On the installation page, type “search replace” on the keyword search field and when the plugin Search & Replace shows up, install it by pressing the Install Now button as shown in the screenshot below.
After installing the plugin, please enable it by pressing the Activate button.
To access the plugin options, move your cursor over Tools on the dashboard left menu and press Search & Replace, as shown in the image below.
On the Search & Replace screen, you will see the following tabs.
- Backup Database: Here, you can backup your database to restore the current content after importing a new SQL file.
- Search & Replace: This tab allows you to define a word to be replaced and a new word to replace the old one (Search & Replace). You also can upload CSV files and specify the tables in which you want to replace the old text.
- Replace Domain URL: This tab is helpful to update a domain name in your site content.
- SQL Import: Here, you can import a new SQL file.
- Credits: Author credits.
To begin, press the Search & Replace tab to show available options, as shown in the screenshot below.
The first two fields allow you to type a string to be replaced and the replacement string within this section. You can
When scrolling down, you can select the tables to replace content. Select all tables to replace the content everywhere on your site.
To apply changes and replace the content, scroll down and press the Do Search & Replace button as shown below.
In case the content you want to replace is a domain name, in the Replace Domain URL tab, you can update URLs on your site. This is especially useful if you update your domain name through the WordPress dashboard (Settings>General) or through phpMyAdmin since these procedures will not change the domain name within your site content. With the step described below, you can achieve it.
Just type the old domain on the first field and the new domain on the second field, then press the Do Replace Domain/URL as shown below.
That’s how you can search and replace content in WordPress using a plugin.
WordPress offers several alternatives to this plugin. Some of them are the following:
- Real-Time Find and Replace: This plugin also replaces theme and plugins content. You can also replace text and code within your site.
- Better Search Replace: This plugin also allows updating tables massively, individually. Like the plugin used in this tutorial, this also can execute a “dry run” to learn the fields to be updated. Additionally, this plugin supports multi-sites.
- CM On Demand Search And Replace: This plugin allows you to search and replace content on-demand, including HTML, phrases, and words, without changing the site database.
- Better Find and Replace: This plugin is used to find and replace content like the options listed above. This plugin does not affect the database while allowing you to replace text, code, footer credits, media, etc.
Take into account all plugins to find and replace content work in a very similar way. After reading this tutorial, you will be able to use all of them easily.
How to do Search and Replace in WordPress with phpMyAdmin:
You also can search and replace content within your WordPress site using phpMyAdmin.
To begin, access your phpMyAdmin dashboard, and select the SQL tab shown in the following image.
Copy and paste the following code, replacing ‘old-text’ with the text you want to replace and ‘new-text’ with the new replacement (Keep the quotation marks).
Then press the Go button to apply changes.
The task is done, and now the old text is replaced by the new one.
As you can see, searching and replacing content in WordPress is pretty easy. By following the instructions explained above, any WordPress-level user can do it. Both ways described in this article are correct, and you can choose any of them. The methods explained above can save you a lot of time, avoiding manually editing individual posts and pages; they also can be used to replace the footer credits in free WordPress themes.
The plugin used in this tutorial is very similar to the alternatives listed after its section; feel free to try any of them.
Thank you for reading this WordPress tutorial. I hope it was helpful. Keep following us for additional tutorials and tips.