Hello, our support team is ready to present you a new tutorial that shows how to find and replace text with one click in your WordPress database.
You might need to find and replace something on your site with one click if you added a specific text or URL to a number of your posts or pages and you do not know which posts or pages exactly you have added that text to.
Using a single command to automatically find and replace the text be much quicker and efficient than searching for this text and replacing it manually.
First of all, you need to create a WordPress database backup. After creating the backup of your WordPress database, you can move on to run your find and replace commands.
Running Find and Replace with a WordPress plugin
There is an easy to use find and replace WordPress plugin called Better Search Replace. To install it navigate to Plugins > Add new and search for Better Search Replace plugin. Install and activate it
After plugin activation, navigate to Tools > Better Search Replace page to use the plugin.
Simply add the text string you want to search for and then add the replace text. After that, you need to select the tables you want to search in. For example, if you find some text in your posts, you need to select the posts table. You can also select multiple tables.
Click on Run Search and Replace when you are done
Running Find & Replace MySQL Query with phpMyAdmin
You can also use phpMyAdmin to find and replace text from your WordPress database.
Open phpMyAdmin tool in your hosting cPanel, open your WordPress database and then click on SQL tab
You will need to enter your SQL query in this format:
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'Text to find', 'text to replace with');
For example, if you wanted to search for text in a WordPress post’s content, then you would write your query like this:
update wp_posts set post_content = replace(post_content,'Text to find','text to replace with');
Click on the Go button to continue. PhpMyAdmin will run your SQL query and upon success it will show the number of rows affected by the query.
If you’re searching for more professional solutions to build a website, have a look at WordPress Themes.